How to implement Exception handling in asp.net

Posted by Er.deepakdalal under Regular Expressions on 5/4/2010 | Views : 2913 | Status : [Member] | Replies : 3
Hi Friends

I want to handle exception in my web application without displaying any deep information about the error, please explain in detail




Responses

Posted by: Raja on: 5/4/2010 [Member] Starter

Up
0
Down
Write something like

try

{

}
Catch (Exception ee)
{
// log the exception in the database or text file using "ee"
// show the error message to the user something like
lblMessage.Text = "Error occured.
}


For more detailed knowledge, please visit

http://www.dotnetfunda.com/articles/article166.aspx
http://www.dotnetfunda.com/interview/exclusive/x1212-how-do-we-do-exception-handling-in-ajax-.aspx
http://www.dotnetfunda.com/interview/exam475-what-is-exception-handling-.aspx

Thank you.

Regards,
Raja, USA

Er.deepakdalal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shikharkum on: 5/5/2010 [Member] Starter

Up
0
Down
Try using Custom Error Pages..

Custom pages are displayed when some errors occur and you can write your own error message in the page and navigation links back to the home page.

Design normal pages as error pages and link them through web.config file.

Hope this helps.

Er.deepakdalal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 5/6/2010 [Member] Bronze

Up
0
Down


Asp.net provides Try catch block to handle expections

try
{

}
catch (Exception ex)
{
// ex.message
}

Thanks
Pavan Kumar
Mark Answer if this fits the need

Er.deepakdalal, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response