Catching ASP.NET errors

Discussion in 'ASP .Net' started by Mikael Engdahl, Aug 15, 2003.

  1. 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
    Mikael Engdahl, Aug 15, 2003
    #1
    1. Advertising

  2. Mikael Engdahl

    Marina Guest

    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" <> wrote in message
    news:...
    > 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
    >
    Marina, Aug 15, 2003
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:...
    > 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
    >
    William F. Robertson, Jr., Aug 15, 2003
    #3
  4. 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/Amit/CustomErrors2.asp


    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Mikael Engdahl" <> wrote in message
    news:...
    > 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
    >
    S. Justin Gengo, Aug 15, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TonyG

    Catching Framework Errors

    TonyG, Aug 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    314
    MS News \(MS ILM\)
    Aug 26, 2003
  2. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    923
    Mark Goldin
    Jan 17, 2004
  3. darrel
    Replies:
    0
    Views:
    306
    darrel
    Sep 28, 2005
  4. fred

    catching EOF errors

    fred, May 19, 2004, in forum: C++
    Replies:
    2
    Views:
    474
    Mike Wahler
    May 21, 2004
  5. yawnmoth
    Replies:
    97
    Views:
    4,645
    Bent C Dalager
    Feb 27, 2009
Loading...

Share This Page