ugly exception messages

J

Jon Paal

how can I get a better looking exception error message to display, instead of the standard error page from asp.net when throwing an
exception like:

If allowExceptions And license Is Nothing Then
If errorMessage Is Nothing Then
Throw New LicenseException(type)
Else
Throw New LicenseException(type, instance, errorMessage)
End If
End If
 
B

Brennan Stehling

In your Global.asax you can handle the Application_Error event. From there
you can do what you like with the exception. You can access that exception
as...

Server.GetLastError

Based on what went wrong you may be able to handle it. Otherwise you can
simply call Response.Redirect to send the user to a static error page.

You can also log the exceptions at this point, perhaps placing it in a
database, and run metrics on it to determine the most frequently raised
exceptions to prioritize which ones you fix first.

Brennan Stehling
http://brennan.offwhite.net/blog/
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top