can not redirect to customized error page

Discussion in 'ASP .Net Web Controls' started by haiwen, Nov 24, 2003.

  1. haiwen

    haiwen Guest

    Hello, everyone.

    I am in trouble to create an error page for my application.

    in Web.config file:
    <customErrors defaultRedirect="errorPage.aspx"
    mode="On" />

    in one .aspx
    private void Page_Load(object sender, System.EventArgs e)
    {
    throw(new Exception("try!!!"));
    }

    But when the error occur, my application can not
    redirected to errorPage.aspx that my customized error page.

    Even I try other ways, such as in <%@Page
    ErrorPage="errorPage.aspx" ... %>

    or
    private void Page_Error(object sender, System.EventArgs e)

    {
    Response.Redirect("errorPage.aspx");
    }

    But I still can not redirect to the errorPage.aspx when
    error occur.

    Could anyone help? I do appreciate your help!!!

    Best Wishes,

    haiwen
     
    haiwen, Nov 24, 2003
    #1
    1. Advertising

  2. haiwen

    haiwen Guest

    Hello, everyone,

    I find out my application redirects to the error page, but
    there is a error in the customized error page.
    That is I have code:
    Label1.Text=Server.GetLastError().Message;

    but the Server.GetLastError() return null???
    It seems I can not get the exception?

    Could anyone help?

    Sincerely,

    haiwen
    >-----Original Message-----
    >Hello, everyone.
    >
    >I am in trouble to create an error page for my

    application.
    >
    >in Web.config file:
    > <customErrors defaultRedirect="errorPage.aspx"
    >mode="On" />
    >
    >in one .aspx
    >private void Page_Load(object sender, System.EventArgs e)
    > {
    > throw(new Exception("try!!!"));
    >}
    >
    >But when the error occur, my application can not
    >redirected to errorPage.aspx that my customized error

    page.
    >
    >Even I try other ways, such as in <%@Page
    >ErrorPage="errorPage.aspx" ... %>
    >
    >or
    >private void Page_Error(object sender, System.EventArgs e)
    >
    >{
    >Response.Redirect("errorPage.aspx");
    >}
    >
    >But I still can not redirect to the errorPage.aspx when
    >error occur.
    >
    >Could anyone help? I do appreciate your help!!!
    >
    >Best Wishes,
    >
    >haiwen
    >
    >
    >.
    >
     
    haiwen, Nov 24, 2003
    #2
    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. Brian Henry

    ASP.NET customized error page

    Brian Henry, Oct 31, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    752
    Guest
    Nov 1, 2003
  2. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,358
    Srowe1975
    Oct 15, 2008
  3. RedHair
    Replies:
    5
    Views:
    6,931
  4. Sal
    Replies:
    1
    Views:
    987
  5. RedHair
    Replies:
    5
    Views:
    321
Loading...

Share This Page