Catching Framework Errors

  • Thread starter Thread starter TonyG
  • Start date Start date
T

TonyG

My site uses the fairly standard approach of trapping errors in the
Application_Error event and dealing with them there.

However, we occasionally get errors that are generated by the Framework
itself and are this not trappeable by our ASP.Net code.

A good example is if someone requests a page just as the site DLL is
being uploaded, an error such as "Cannot access file XXXXXX as it is
being used by another process" is generated.

These errors are dreadful for a number of reasons.

1). They are butt ugly
2). They contain a plethora of sensitive information including
details like dll name, appBase, drive paths etc etc.
3). They do not appear to be trappeable

MY question is this. How can I catch these pages and deal with them in a
more graceful manner?

I NEED to be able to serve a custom page to my users as this page is a
horror.

Any help would be very gratefully received.
 
It works, I was able to get to the custom error page when the .dll is
missing
Here is what you have to do

1- in web.confg add the following line, save the file
<customErrors mode="On" defaultRedirect="mycustompage.htm"/>

2- create the mycustompage.htm and place your custom error in there, save
the file

3- remove the .dll of your project from the bin directory

4- Open IE and try to open your project

5- You will get your Custom Error

6- Return the .dll back to the bin Directory of your project

7- Refresh the browser and you still see the custom error

8- Close I.E.

9- Reopen IE and open your Project

10- Back to normal

That's it, you are done

conclusion: ASP.NET looks into your web.config first which is good even if
you have no .dll in your bin directory

any other comments are welcome.
 
Back
Top