Catching Framework Errors

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.
 
M

MS News \(MS ILM\)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top