Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:37:16+00:00 2026-06-11T07:37:16+00:00

Here the scenario is I have many .aspx pages if any page gives error,

  • 0

Here the scenario is I have many .aspx pages if any page gives error, it will redirect to an error page

Web.config:

<customErrors mode="On" defaultRedirect="customErrorPage.aspx">
       <error statusCode="404" redirect="Error404.aspx" />
</customErrors>

If I get 404 error it will redirect to Error404.aspx works fine.

But if their any other error (forbidden, connectionlost, service unavailable etc) then I want to redirect to customErrorPage.apsx.

I want to send an email with error information (error pagename, error statusCode) when the custom error page is displayed and later after few minutes it will auto redirect user to login.aspx.

I have tried (not working)

void Application_Error(object sender, EventArgs e) 
{ 
        ex = (HttpException)Server.GetLastError();
        int errorcode = ex.GetHttpCode();
  //    Response.Redirect("Errorpage.aspx?id='" + errorcode + "'&msg='" + message + "'");
}

My custom error page

protected void Page_Load(object sender, EventArgs e)
{
         getUrl = HttpContext.Current.Request.Url.ToString();
        // string error=  HttpContext.Current.Error.ToString();
        //   HtmlMeta meta = new HtmlMeta();
       //   HtmlHead head = (HtmlHead)Page.Header;
        // meta.HttpEquiv = "refresh";
        //   meta.Content = "10;   url=Login.aspx";
        //  head.Controls.Add(meta);
}

protected void Page_UnLoad(object sender, EventArgs e)
{
       //send mail function
       Email.Send("abc@asa.com", "Error Log", "custom error", true);
}

ALSO let me know if their is any other good way to this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:37:17+00:00Added an answer on June 11, 2026 at 7:37 am

    Here how i solved :

    Globasl.asax:

     void Application_Error(object sender, EventArgs e) 
        {
            Exception objErr = Server.GetLastError().GetBaseException();
            string err = "<br><b>Error in: </b>" + Request.Url.ToString() +
                "<br><b>Error Message: </b>" + objErr.Message.ToString() +
                "<br><b>Stack Trace:</b><br>" + objErr.StackTrace.ToString();
           //Email sending method
           Email.Send("example@gmail.com", "Error", err, true);
        }
    

    Web.config:

    <customErrors mode="Off" defaultRedirect="Customerrorpage.aspx">
          <error statusCode="404" redirect="Error404.aspx" />
    </customErrors>
    

    Customerrorpage.aspx : (Auto redirect to login page in few sec)

    protected void Page_Load(object sender, EventArgs e)
        {
            Response.AppendHeader("Refresh", "4; url=Login.aspx");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the scenario: I have a private site that, once logged on, will display
Here is the scenario: You have a Persons table with a one-to-many relationship with
Here's the simplified scenario: I have a page with two sections: a search section,
Here is my scenario: I have two MySQL tables: Categories (columns: id, category) Items
Here's the scenario: I have a public repo A . Bob forks A ,
Here is my scenario: I have an Eclipse project in my desktop in a
Here is the scenario: I have a visual that displays some data The data
Here's the scenario: I have 2 tables with data, one is the 2009 version
Here's the scenario: I have 2 tables: CREATE TABLE dbo.API_User ( id int NOT
Here is the scenario: I have an object called a Transaction that needs to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.