ugly exception messages

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default ugly exception messages

    how can I get a better looking exception error message to display, instead of the standard error page from asp.net when throwing an
    exception like:

    If allowExceptions And license Is Nothing Then
    If errorMessage Is Nothing Then
    Throw New LicenseException(type)
    Else
    Throw New LicenseException(type, instance, errorMessage)
    End If
    End If




    Jon Paal Guest

  2. Similar Questions and Discussions

    1. #32101 [Com]: Exception in unknown on line 0 when throwing exception inside exception handler
      ID: 32101 Comment by: dhopkins at DonHopkins dot com Reported By: ceefour at gauldong dot net Status: No...
    2. Tabs ugly
      http://www.dmdregistry.org/reports/predictor_flash/bin/tabtest.swf Notice 1st tab has "..." Why? Click on second tab and the end "t" gets...
    3. ugly code!
      <?php function ugly_array() { return array(1, 2, 3, 4, 5); } $arr = ugly_array(); echo $arr; ?> not so ugly :) now ... I want to get rid...
    4. SoapExtension for Global Exception handling; but prevent exception from propagating!!
      Hi, I wrote a SoapExtension for Global Exception handling in Webservice and it works!!!! Now i want to catch the exception that happen in the...
    5. good, bad, or just ugly
      Taking the content out of context the site seems to navigate easily. FireLion ------------------- may the flash be with you
  3. #2

    Default Re: ugly exception messages

    You can use custom error pages, or catch errors at page elevel (Page_Error
    or event handlers) and show it in a nice Label or something.

    Related:

    [url]http://blogs.msdn.com/mattwag/archive/2005/02/07/368605.aspx[/url]
    [url]http://www.codeproject.com/aspnet/ErrorHandlingASPNET.asp[/url]

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    [url]http://blogs.aspadvice.com/joteke[/url]



    "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
    news:uwWvPrD1GHA.3464@TK2MSFTNGP03.phx.gbl...
    > how can I get a better looking exception error message to display, instead
    > of the standard error page from asp.net when throwing an exception like:
    >
    > If allowExceptions And license Is Nothing Then
    > If errorMessage Is Nothing Then
    > Throw New LicenseException(type)
    > Else
    > Throw New LicenseException(type, instance, errorMessage)
    > End If
    > End If
    >
    >
    >
    >

    Teemu Keiski Guest

  4. #3

    Default Re: ugly exception messages

    The trick I found to work is to use Synchronous HTTP Handlers

    [url]http://windowssdk.msdn.microsoft.com/en-us/library/ms228090.aspx[/url]


    "Teemu Keiski" <joteke@aspalliance.com> wrote in message news:%23nNIZUP1GHA.4748@TK2MSFTNGP04.phx.gbl...
    > You can use custom error pages, or catch errors at page elevel (Page_Error or event handlers) and show it in a nice Label or
    > something.
    >
    > Related:
    >
    > [url]http://blogs.msdn.com/mattwag/archive/2005/02/07/368605.aspx[/url]
    > [url]http://www.codeproject.com/aspnet/ErrorHandlingASPNET.asp[/url]
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > [url]http://blogs.aspadvice.com/joteke[/url]
    >
    >
    >
    > "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message news:uwWvPrD1GHA.3464@TK2MSFTNGP03.phx.gbl...
    >> how can I get a better looking exception error message to display, instead of the standard error page from asp.net when throwing
    >> an exception like:
    >>
    >> If allowExceptions And license Is Nothing Then
    >> If errorMessage Is Nothing Then
    >> Throw New LicenseException(type)
    >> Else
    >> Throw New LicenseException(type, instance, errorMessage)
    >> End If
    >> End If
    >>
    >>
    >>
    >>
    >
    >

    Jon Paal Guest

  5. #4

    Default Re: ugly exception messages

    In your Global.asax you can handle the Application_Error event. From there
    you can do what you like with the exception. You can access that exception
    as...

    Server.GetLastError

    Based on what went wrong you may be able to handle it. Otherwise you can
    simply call Response.Redirect to send the user to a static error page.

    You can also log the exceptions at this point, perhaps placing it in a
    database, and run metrics on it to determine the most frequently raised
    exceptions to prioritize which ones you fix first.

    Brennan Stehling
    [url]http://brennan.offwhite.net/blog/[/url]


    "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
    news:uwWvPrD1GHA.3464@TK2MSFTNGP03.phx.gbl...
    > how can I get a better looking exception error message to display, instead
    > of the standard error page from asp.net when throwing an exception like:
    >
    > If allowExceptions And license Is Nothing Then
    > If errorMessage Is Nothing Then
    > Throw New LicenseException(type)
    > Else
    > Throw New LicenseException(type, instance, errorMessage)
    > End If
    > End If
    >
    >
    >
    >

    Brennan Stehling Guest

Posting Permissions

  • You may not post new threads
  • You may 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