Those misleading custom errors

On November 27, 2009, in Technical, by Raymond

With .Net you can configure your own custom error pages. Which means rather than letting the server generate its default error page you can place your own page depending on the HTTP status code that produces the error.  The problem is the custom error page can itself can generate its own status error page.

Here is an example; you have an ASP.Net application and it was working fine, but suddenly you get an “HTTP Error 404- File or Directory not found” error. You check all your files and folders and nothing has changed.  All the files and folders appear to be there.  A few minutes later the application is back up.  No big deal, right? You go on your daily routine.  Sometime later it happens again; the same error: “HTTP Error 404- File or Directory not found.”

The first thing you should look at is the URL in the browser.  If you see “aspxerrorpath=” in the address of the URL then your application is trying to generate a custom error page.  The “404 file or directory not found” message means that the path set to display the custom error page is either incorrect or the custom error page itself is not where the path specified. The application is generating an error, yes, but the error you are seeing is being generated by your custom error configuration.

You have two basic options to stop the “HTTP Error 404- File or Directory not found.” First, make sure that the custom error page exist where the custom error settings specify it does.  Once you fix any problems with that path you will no longer get the “HTTP Error 404- File or Directory not found” error, but rather the custom error page you designed.  The problem with this is that your application can still generate an error and you will not know what it is because the custom error page is hiding it.

The second – and in my opinion the best – step is to simply disable custom error handling.  That way when your application generates an error you can take the necessary steps to correct it.

We all know errors are bad, but if you do not know what the problem is, it is next to impossible to fix it.

Raymond Penalosa
Technical Support

 

Leave a Reply

iBlog by PageLines