Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Catching ASP.NET errors

Reply
Thread Tools

Catching ASP.NET errors

 
 
Mikael Engdahl
Guest
Posts: n/a
 
      08-15-2003
Hello,

When an unhandled exception occurs on an ASP.NET page, a well known page
will appear, having the header "Server Error in '[app path]' Application"
and the Exception Details and Stack Trace below it.

Is it possible to customize this page and for example save to exception
info in a database and display a custom message to the user.

Does anybody know if this is possible?


--
Mikael Engdahl

 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      08-15-2003
There is an Error event in the page class. If you handle it, you can do
whatever you want, including making sure that this error page never displays
at all.

There is also an Application_Error event in Global.asax, which handles
unhandled errors from the entire application.

"Mikael Engdahl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> When an unhandled exception occurs on an ASP.NET page, a well known page
> will appear, having the header "Server Error in '[app path]' Application"
> and the Exception Details and Stack Trace below it.
>
> Is it possible to customize this page and for example save to exception
> info in a database and display a custom message to the user.
>
> Does anybody know if this is possible?
>
>
> --
> Mikael Engdahl
>



 
Reply With Quote
 
 
 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      08-15-2003
I would recommend writing your own page class that will handle the errors
experience on every page. It saves you from having to put the
Page.OnError() method of every page.

I used to use Application_OnError but I could consistently have access to
the session variables that held user information, and I was trying to catch
the sql query used that crashed the page (usually that is where the
Exceptions are for my project).

bill

"Mikael Engdahl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> When an unhandled exception occurs on an ASP.NET page, a well known page
> will appear, having the header "Server Error in '[app path]' Application"
> and the Exception Details and Stack Trace below it.
>
> Is it possible to customize this page and for example save to exception
> info in a database and display a custom message to the user.
>
> Does anybody know if this is possible?
>
>
> --
> Mikael Engdahl
>



 
Reply With Quote
 
S. Justin Gengo
Guest
Posts: n/a
 
      08-15-2003
Mikael,

Yes, you can customize what page is shown using the web.config file.

Here's a link that shows exactly how to do this:

http://www.devasp.net/Net/Articles/A...tomErrors2.asp


Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche


"Mikael Engdahl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> When an unhandled exception occurs on an ASP.NET page, a well known page
> will appear, having the header "Server Error in '[app path]' Application"
> and the Exception Details and Stack Trace below it.
>
> Is it possible to customize this page and for example save to exception
> info in a database and display a custom message to the user.
>
> Does anybody know if this is possible?
>
>
> --
> Mikael Engdahl
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does catching errors that aren't thrown give syntax errors? yawnmoth Java 97 02-27-2009 12:07 AM
catching errors with XPathExpression darrel ASP .Net 0 09-28-2005 04:44 PM
catching EOF errors fred C++ 2 05-21-2004 08:02 PM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
Catching Framework Errors TonyG ASP .Net 1 08-26-2003 06:52 PM



Advertisments