|
Why do you want to catch exception at server side.. you can do it by custom validator also
but if you want to do it server side only... put ValidateRequest="false" in page attribute.. Now .Net allow this request to go server side.Now make your handler to throw some exception according to your need and show the message accordingly..
Cheers!!
Brij
|
|
|
|
|
I am writing a code which send Email to the respective email address. First time its working fine. But after sending my first email its not accept my program and I am not able to send email again. I put the code snippet here.
Dim smtpServer As New SmtpClient
Dim messageSTR As New MailMessage
Dim strAddress As New MailAddress("Email address", "Name")
messageSTR.From = strAddress
messageSTR.To.Add("To Email Address")
messageSTR.Subject = Me.txtSub.Text
messageSTR.Body = Me.txtMailBody.Text
smtpServer.Host = "smtp.gmail.com"
smtpServer.Port = 578
smtpServer.Credentials = New NetworkCredential("user id", "user pass")
smtpServer.EnableSsl = true
smtpServer.Send(messageSTR)
What is the problem? Why I don't send the second mail?
Exception Shown: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 209.85.129.109:578.
Error Message: Unable to connect to the remote server
modified on Friday, January 1, 2010 11:23 AM
|
|
|
|
|
Can you post the error details that you are getting.It'll be of helpful to give the relevent answer
Cheers!!
Brij
|
|
|
|
|
The problem was,
I am writing the invalid port number.
I put portnumber=578 But it should be 587.
Thanks.
|
|
|
|
|
is your problem resolved? If so kindly write it so that others may know that your problem is resolved
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
ok.. but wasn't it created the problem in sending first mail ?
Cheers!!
Brij
|
|
|
|
|
At first, I send mail using default port number. Then I take it from the user and then creates the problem.
Thanks
|
|
|
|
|
Hi,
I have a project requiement to build a facebook like website in C# & ASP
In this website:
- Allow at least 3 types of users: unregistered visitor, registered user and moderator
- Allow users to create profiles and upload images etc.
- Any user can search for people and view public profiles
- Registered users can create a profile which can connect with other members or groups of people can join. Each user can set their profile : public or private.
- Each user can add albums with pictures. Every picture may receive comments from friends or from other users which the user can accept or reject
- The user has one mailbox that can communicate with other members of the site.
etc etc
I am a novice when it comes to coding, I have so far been able to create profiles and allow uploading of images and returning but I seem to be lost at doing stuff like retrieving a user's images when his profile picture is clicked etc etc. Are there any references you guys could point me to that would give me more information on developing this. I like doing things on my own but would be useful if I could refer to a source for more info when I got stuck.
Thanks so much for helping!
Kool
|
|
|
|
|
|
Hi..
Happy New Year 2010.
I want to read all the available control from a physical aspx pages...How can I achieve this....I really need your Help..
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Controls property on a Page gives all child controls. Is that what you are looking for?
Best wishes,
Navaneeth
|
|
|
|
|
Navaneeth wish you and your family a very very happy new year !
All the best !!!
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Many thanks and wishes to you too.
Best wishes,
Navaneeth
|
|
|
|
|
Dear Navaneeth & Abhijit
Happy New Year...
Could you provide some sample C# source on that...
Thanks a lot.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Something like,
void IterateChildrenRecursively(Control control)
{
foreach(Control c in control.Controls)
{
IterateChildrenRecursively(c);
}
}
IterateChildrenRecursively(this); New year wishes to you too.
Best wishes,
Navaneeth
|
|
|
|
|
Thanks
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
i have to add fieldset control to my page on page load and add controls to this control. can any body help me on that. Thanks
|
|
|
|
|
hi
I don't know FieldSet control but I know how to insert a controls at runtime
You can use Page Controls property.
Panel panel=new Panel();
this.Controls.Add(panel);
Mohammad Khansari
|
|
|
|
|
I was given a started c++ project (written using vs 2005) to finish. It includes managed and unmanaged code.
I would like to continue the project in vb.
From searching the web, it seems like I have to compile it as a dll (or 2 different dlls?!), then access the dll from a vb project.
Is this do-able?
Is there anyone that can guide me, step by step in how to do this? I don't have any experience in creating dll's and I'm feeling quite lost by now.
Thanks a million in advance
|
|
|
|
|
You are in wrong Forum. This is ASP.NET Forum. !!
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi,
I'm using visual studio 2008 and it's built in development webserver, with C# as the codebehind language.
I'm trying to make a simple webapp in which you click a button which sets a session var (that part is working) and in the pageload
i'm checking to see if it's a postback and if the session is not null. problem is that every time the session is null.
I have done this successfully before with visual studio 2003 and on IIS.
Here is the relevant code:
<br />
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
Session["testvar"] = 25;<br />
<br />
<br />
}<br />
<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (IsPostBack)<br />
{<br />
int x;<br />
<br />
<br />
<br />
if (Session["testvar"] == null)<br />
Response.Write("test var is null");<br />
else<br />
{<br />
x = (int)Session["testvar"];<br />
TextBox1.Text = x.ToString();<br />
}<br />
<br />
<br />
<br />
}<br />
}<br />
<br />
<br />
Any help is appreciated.
Thanks
|
|
|
|
|
What session mode is selected in web.config ? What is the session timeout time ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I've haven't set either of those, everything is left to default in web.config, the only thing I enabled was debugging.
From my readings the default of inProc should be sufficient.
|
|
|
|
|
Based on the code above, you have to click the button twice in order for the session var to show in the textbox.
this is because the execution goes in this order:
Page Load
--You click Button
Page Load
Button Click
|
|
|
|
|
Yes that was it.
I ended up using the prerender event.
Thanks
|
|
|
|