PC Review


Reply
Thread Tools Rate Thread

Catching ASP.NET errors

 
 
Mikael Engdahl
Guest
Posts: n/a
 
      15th Aug 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
 
      15th Aug 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" <mikael-(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
 
      15th Aug 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" <mikael-(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
 
      15th Aug 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" <mikael-(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
Rate This Thread
Rate This Thread:

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
catching all errors =?Utf-8?B?cm9kY2hhcg==?= Microsoft ASP .NET 6 20th Nov 2006 01:19 PM
Catching errors cbh35711 Microsoft Excel Programming 0 3rd Apr 2006 09:52 PM
How to catching DLL run-time errors in VB.net? R. MacDonald Microsoft VB .NET 0 12th Jan 2006 01:20 PM
Catching run time errors Manish Soni Microsoft C# .NET 3 31st May 2005 05:36 PM
Catching Framework Errors TonyG Microsoft ASP .NET 1 26th Aug 2003 07:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:03 PM.