Hi there,
The warning is telling you that you declare a variable (ex) that you never use.
The ex variable is declared in the catch block but then you never use it. Either get rid of it altogether, or use it for something useful. That is, change the code to this:
Code:
catch (Exception)
{
lblMessage.Text = "An error occurred while sending your e-mail. Please try again.";
}
or this
Code:
catch (Exception ex)
{
lblMessage.Text = "An error occurred while sending your e-mail. Please try again. Details: " + ex.Message;
}
The latter is not a good solution as it provides detailed error information to the client. However, it's good to now you can access the ex variable so you can log it to an error log like a database for example.
For more info and detailed explanations:
http://www.google.com/search?hl=en&q...+never+used%22
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
Beginning ASP.NET 3.5 : in C# and VB,
ASP.NET 2.0 Instant Results and
Dreamweaver MX 2004
Want to be my colleague? Then check out this post.