If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
About two weeks back I wrote about an error reporting and handling routine that I added to every page of my digital lard website to try and capture fix some of the many page errors I was getting. Here is a link to the article for reference.
The results of the routine I added were phenomenal, even though it was hard work I managed to fix around 95% of the errors. The problem I’m now faced with is the 5% left and I find them very perplexing indeed. It seems that no amount of information I throw back through email can help me get to the bottom of them and some of them do seem to be browser specific, for example there is one specific problem that always seems to come with Opera browser and even though I’ve downloaded Opera I cannot reproduce the problem myself.
I’ve decided that the only option left to me is to ask the end user who got the error what they were doing that caused the error in the first place. So in order to do this the first thing I needed to do was create a custom error page that had a feedback form on it. So I created a page called ErrorPage.aspx and placed it in the site root. I won’t go into details of how to create a feedback form as it’s fairly rudimentary stuff and there’s a ton of resources out there to show you how to do that. I also don’t want to link to my error page as I don’t really want to start generating backlinks for it. So I’ll just show a screenshot below of what the page looks like:
So now I have my error page I somehow need to direct people to it. This is actually quite easy in Asp.Net 2 as you can do it in the web.config. All you need is the following code in your web.config:
<customErrors mode="On" defaultRedirect="/MyErrorPage.aspx">
<error statusCode="404" redirect="/My404.aspx"/>
<error statusCode="500" redirect="/ErrorPage.aspx"/>
</customErrors>
Basically this states that general errors and “500 Internal Server Error” errors should be redirected to MyErrorPage.aspx, I’ve also added a separate error page for “404 Page Not Found” errors with a different message and the correct http server headers for 404 errors.
The web.config redirect also adds a querystring of “aspxerrorpath=/sourcepage.aspx” when it redirects. So in code I capture this string and add it to the feedback form to help with diagnosing the error.
Functionally this system works great, the on page error code sends me the email of the error and then the web.config redirects to the nicely formatted error page. Pre filled with some of the information, like error path, browser type etc. What I don’t know yet is whether or not anyone will fill in the form but time will tell on that one.




