Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

Application_OnError handler not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cashdeskmac - 10 Oct 2007 20:30 GMT
Hi,

I have a web application which has an error handling layer which is
performing quite well.

Any exceptions caught in a try/catch block are fed to this layer and they
pass the exception to an error page which gives up some useful information.

The problem is, if an error occurs outside of the try/catch we have code in
the Global.asax's Application_OnError handler which does the exact same thing
(get the last error, gather the required info, clear the error, clear State,
tell the (non-.NET) framework to redirect to the error page, etc.)   Trouble
is, this doesn't seem to be happening.  

I replicated an Object ref not found exception in a try/catch and all was
well.  I tried a DivideByZero exception outside of the try/catch and I got
the basic 'yellow page'.  

Does anyone know a reason why this code wouldn't execute?  I have no page
level error handling for unexpected exceptions, so it should propogate to the
Application level and be caught in the Global.asax.  

I tried debugging the application but it didn't step into the Global.asax,
just gave the 'yellow page'.

Any ideas would be much appreciated.
Alvin Bruney [MVP] - 11 Oct 2007 02:35 GMT
Yup, it should trap the error at the global handler. Try this - I suspect
the global file may be corrupted - handle the appdomain unhandled exception
event from the global asax code behind or the thread unhandled exception. If
you can't catch those, I would copy the contents of the code behind/besides
file, delete and add a new global asax file and paste in the contents of the
code behind/besides file.

Signature

Regards,
Alvin Bruney
------------------------------------------------------
Shameless Author Plug
OWC Black Book 2nd Edition
Exclusively on www.lulu.com/owc
$24.99

> Hi,
>
[quoted text clipped - 28 lines]
>
> Any ideas would be much appreciated.
cashdeskmac - 11 Oct 2007 09:46 GMT
Thanks, Alvin,

I was looking into the AppDomain.Current.UnhandledException event a few days
ago but wasn't sure where to implement it (each page or in the Global.asax).

It turns out that my Global.asax was in the wrong folder (my app has over a
hundred projects, each with their own Global, but there wasn't a copy in the
root directory).  I placed one there and everything works as desired now.

Thanks again,

Mac

> Yup, it should trap the error at the global handler. Try this - I suspect
> the global file may be corrupted - handle the appdomain unhandled exception
[quoted text clipped - 35 lines]
> >
> > Any ideas would be much appreciated.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.