Adding error handling in asp.net is easy:
- Create an error page in your application (eg error/Error.aspx).
- In the <customErrors/> config, set the defaultRedirect="error/Error.aspx" and voila!
- You have a couple of opportunities to handle the error (when it happens, in the page, or in the application):
- In the page: public void Page_Error(object sender, EventArgs e)
- In the application (Global.asax: protected void Application_Error(object sender, EventArgs e)
- Then you can access the actual exception via Server.GetLastError().GetBaseException();
So at work our exceptions get mailed. Since azure currently doesn't have mail servers, we opted to use SendGrid which seemed quite ok.
Full guide here http://support.microsoft.com/kb/306355.
No comments:
Post a Comment