Geeks With Blogs
Nouman Zakir while (true) { Post.NewArticle(); }

It's very important to log any uncaught exceptions that your ASP.NET application generates. Otherwise you may not be aware of serious problems with your website. You can trap exceptions by writing an Application_Error method in Global.asax. Call Server.GetLastError() to get the exception.I recommend logging the following data so that you'll be able to troubleshoot the problem:

Data How to Retrieve
Current Time DateTime.Now
Request IP Address Request.UserHostAddress
Referring URL (page user was on when the current page was requested) Request.UrlReferrer
User Agent (browser or spider that issued the request) Request.UserAgent
User Host Name Request.UserHostName
All HTTP Headers Request.Headers
All Form Fields Request.Form
Exception Details ex.GetType(), ex.Message, ex.StackTrace, where ex is the exception returned by Server.GetLastError()
Inner Exception Details Same as above, if ex.InnerException is not null.

If you find yourself getting spurious entries in your exception log that you'd like to suppress, I suggest putting regular expressions in your web.config file that match the entries that you're not interested in. When an uncaught exception occurs, generate the log entry, but then see if any of the regular expressions match the log entry. If any do, don't save the log entry.

Posted on Sunday, January 25, 2009 3:50 AM | Back to top


Comments on this post: Log uncaught application exceptions

# re: Log uncaught application exceptions
Requesting Gravatar...
You have clearly listed the uncaught application exceptions and I think it will be very much easier to all getting a better awareness on these exceptions. I am very happy to know this information. Thanks a lot! catalina island hotels
Left by Paul on Sep 18, 2015 9:35 AM

Your comment:
 (will show your gravatar)


Copyright © Nouman Zakir | Powered by: GeeksWithBlogs.net