views:

257

answers:

2

I can't figure out why the exception from a static ASP.Net Page method isn't bubbling up to the Application_Error event to be handled in the global.asax file. I'm not really expecting any errors, but I would like to be safe and know about them if they do happen to occur and would rather not wrap every static method in a try...catch.

Does anyone know how to catch these exceptions or at least why they aren't bubbling?

+1  A: 

Exceptions bubble to the error handler in Application_Error if they are not being handled in the lower layers. If you already have a TRY/CATCH block where you think the exception is occurring, it will be trapped at that point.

Please post the code of your static method and your Application_Error. It will make it easier to provide you with an accurate answer instead of a generalized one.

Jose Basilio
Thanks, I finally found the problem. Buried deep down was a try...catch that was absorbing the error. Once I took that out, all was well again and I have my errors again.
Jared
A: 

If developing in Visual Studio, you should debug your code and then step through the source to find the exception and see what is catching it before bubbling up to your Application_Error method.

Wayne