Trapping Unhandled Errors with Global.asax

I'm using Global.asax to trap any unhandled errors in my aspx program.  When running on my development machine, unhandled errors are correctly trapped by Global.asax -> Application_Error.

When I publish the web site (as precompiled) and upload it to my web site, unhandled errors are no longer trapped by Global.asax.  Instead, they are displayed on the web page with the heading "Server Error in '/' Application".

My web site is hosted by Network Solutions on a Windows server using shared hosting.

Any suggestions on what I might need to do to have Global.asax process my errors rather than whatever debugger might be running under the hosting package?

Thank you in advance for your help!

Who is Participating?
Obadiah ChristopherConnect With a Mentor Commented:
Is customErrors mode="On" in web.config file?
Are you sure the error is not getting passed to Global.asax? Perhaps the error is actually occurring in your Global.asax handler. This is just my guess since you don't show what the error page looks like.
CIW_GeorgeAuthor Commented:
To test the unhandled error handler, I've hardcoded 'Dim x As Integer = Math.Sqrt(-1)' into my aspx program.  This should eliminate any random errors and the web error indicates that this statement is an error.

I'll be glad to post my code (it's relatively simple at this point 'cause I'm testing as I go), but I suspect the problem may be how Network Solutions' server or the VS Publisher is configured (or not...).

I do not make any changes to my code between what I'm running on my machine vs. what I publish and upload to NS.
What happens if the only thing you do in your error handler is to transfer your page to your error handling page?

CIW_GeorgeAuthor Commented:
Thank you informaniac!

Changing customErrors mode="On" allowed Global.asax to trap unhandled errors on the web site.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.