Professional Web Applications Themes

Catching ASP.NET errors - ASP.NET General

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...

  1. #1

    Default 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

    Mikael Guest

  2. #2

    Default Re: Catching ASP.NET errors

    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" <no.spam.com> wrote in message
    news:phx.gbl... 


    Marina Guest

  3. #3

    Default Re: Catching ASP.NET errors

    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" <no.spam.com> wrote in message
    news:phx.gbl... 


    William Guest

  4. #4

    Default Re: Catching ASP.NET errors

    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" <no.spam.com> wrote in message
    news:phx.gbl... 


    S. Guest

Similar Threads

  1. cferror not catching errors
    By bryn in forum Macromedia ColdFusion
    Replies: 4
    Last Post: March 26th, 10:40 AM
  2. Catching DateValidator errors
    By dzlmbq in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: July 12th, 04:07 PM
  3. Cferror not catching CFML construct errors
    By aGuyNamedMichael in forum Macromedia ColdFusion
    Replies: 2
    Last Post: April 6th, 12:57 AM
  4. catching script errors in PSQL and redirecting to file?
    By Andrew Lapides in forum PostgreSQL / PGSQL
    Replies: 1
    Last Post: December 15th, 06:47 AM
  5. #25842 [NEW]: Error Reporting not catching p errors
    By corrupted_wise at yahoo dot com in forum PHP Development
    Replies: 0
    Last Post: October 12th, 03:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139