473,785 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Catching ASP.NET errors

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

Nov 17 '05 #1
3 1395
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_Err or event in Global.asax, which handles
unhandled errors from the entire application.

"Mikael Engdahl" <mi******@engda hl.no.spam.com> wrote in message
news:uJ******** ******@tk2msftn gp13.phx.gbl...
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

Nov 17 '05 #2
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_OnE rror 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" <mi******@engda hl.no.spam.com> wrote in message
news:uJ******** ******@tk2msftn gp13.phx.gbl...
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

Nov 17 '05 #3
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" <mi******@engda hl.no.spam.com> wrote in message
news:uJ******** ******@tk2msftn gp13.phx.gbl...
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

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2491
by: Florian Fredegar Haftmann | last post by:
Hi! I'm working on a tool which helps in testing applications with web-frontends (on Windows) On thing I would like to test ist the occurence of JavaScript errors; the idea is that the test tool does many request and actions on the Internet Explorer and collects all errors (including JavaScript errors) together into a report. I've setted up a framework for controlling an Internet Explorer instance using Python and win32com, but so far I...
2
2511
by: PapaBear | last post by:
Hi y'all, I'm handling Apache errors through seperate shtml files. That surely looks better than the standard error pages by the browser etc. I did this by coding in httpd.conf lines like: ErrorDocument 403 http://levi.prodeo/errors/err_403.shtml ErrorDocument 404 http://levi.prodeo/errors/err_404.shtml ErrorDocument 405 http://levi.prodeo/errors/err_405.shtml
2
1750
by: fred | last post by:
Hello, I read a file from several classes and want to catch an EOF when it appears. Having caught the EOF I want to allow the final part of the program to continue rather than just exiting. At present I use methods which read from the file; test the read was successful and return a 1 if not. This is then checked by the calling method, which also returns a 1 if the other method returned 1 (thus
7
2340
by: cmay | last post by:
FxCop complains every time I catch System.Exception. I don't see the value in trying to catch every possible exception type (or even figuring out what exceptions can be caught) by a given block of code, when System.Exception seems to get the job done for me. My application is an ASP.Net intranet site. When I catch an exception, I log the stack trace and deal with it, normally by displaying an error
0
1073
by: R. MacDonald | last post by:
Hi, I have a VB.Net application that dynamically calls unmanaged routines in a DLL that has been created by Fortran (DVF v5). The call to the DLL routine is within a Try/Catch block, but when one of the DLL (Fortran) routines triggers a run-time error, the VB.Net application terminates rather than catching the error. Is there any way to be able to catch these Fortran run-time errors in
2
2368
by: Eric Lilja | last post by:
Hello, consider this complete program: #include <iostream> #include <string> using std::cout; using std::endl; using std::string; class Hanna {
1
2231
by: Hari Sekhon | last post by:
I've written an except hook into a script as shown below which works well for the most part and catches exceptions. import sys def myexcepthook(type,value,tb): do something sys.excepthook=myexcepthook rest of script.... (now protected by catchall exception hook)
4
1966
by: John Pye | last post by:
Hi all I have some C code that is giving me some 'nan' values in some calculations. The C code is wrapped using SWIG to give me a Python module that I am then exercising through a unittest suite. It seems that I should expect the C code to throw floating point exceptions (SIGFPE) and either the whole thing to abort, or for Python to catch the errors and report them. Instead I'm getting neither. I want to be able to track down the...
25
2373
by: JJ | last post by:
I only want to catch 404 errors at the application level (the rest are will be handled by the customerrors section of the web.config). How do I check for the error code in the Application_Error of Global.asax ? Thanks, JJ
3
3289
by: john | last post by:
I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: # "grid" is a wrapped fortran module # no runtime errors incurred when run with the correct inputs for filetype #------------------------------- def readGrid( self, coord='xyz' ): mg = ( '.FALSE.', '.TRUE.' ) form = ( 'FORMATTED', 'UNFORMATTED' )
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.