Results 1 to 7 of 7

Thread: Is there a way to set one error page for all errors?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Is there a way to set one error page for all errors?

    well the bookie that I'm reading is creating a separate error page for different error numbers. I'm wondering if it is possible to have one error page that would also desplay the specific error that happened. IE, errorReport.aspx would tell the user what error was raised... no idea, is it possible?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    well, you could probably write you own error class. I wrote one for asp to work with the template system I use. I haven't rewritten all my stuff to work with .NET yet, so I'm not sure it will work correctly. I can attach the error class I created for asp if you like.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Memnoch1207
    well, you could probably write you own error class. I wrote one for asp to work with the template system I use. I haven't rewritten all my stuff to work with .NET yet, so I'm not sure it will work correctly. I can attach the error class I created for asp if you like.
    sure, but only if your class is in asp.net

    btw this bookie says that I can use an error page by changing the DefaultRedirect tag in web.config (<customErrors...DefaultRedirect=errorpage)

    I'm wondering how is it possible to figure out the error that was raised if every error is being redirected to a single page. Is it possible to POST the error code to the page?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    my error class hasn't been rewritten yet to work with .NET
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  5. #5
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    try this:

    Code:
        Exception[] ers = HttpContext.Current.AllErrors;  
        foreach (Exception e in ers)
            Response.Write(e.Message);

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    hmm lethal, I think HttpContext.Current.AllErrors will only get the errors that have happened in the CURRENT page.
    This is what I have in web.config

    <customErrors mode="RemoteOnly"
    defaultRedirect="errorReport.aspx"
    />

    so when an exception is thrown, it will load errorReport.aspx... I tried your code in that page, but the AllErrors method returns nothing since no errors happened in that page.
    This is the redirected URL, it tells me what page the error is comming from, but is there a way to also determine what the error was?
    http://..../WebApplication2/errorReport.aspx?aspxerrorpath=/webapplication2/journal/Default.aspx
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Yeah, I didn't test the code, I thought maybe it would work. I'll do some more diggin' around.

Posting Permissions

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



Click Here to Expand Forum to Full Width