[ASP. NET custom error page]

Source: Internet
Author: User
Determine error page error.html

The error page can avoid leakage when the program throws an exception, which may lead to security problems. It only gives users the opportunity to view the error page, and will automatically jump to the homepage in 5 seconds.

The procedure is as follows:

  1. Create an error page in the project: error.html
  2. Add a piece of JS Code to its head
    <Script language = "JavaScript" type = "text/JavaScript"> var I = 5; var intervalid; intervalid = setinterval ("Fun ()", 1000); function fun () {if (I = 0) {window. location. href = "default. aspx "; clearinterval (intervalid);/* clear ytimer */} document. getelementbyid ("mes "). innerhtml = I; I -- ;}</SCRIPT>

The HTML code is as follows:

<H3> An error occurred ~~~~ </H3> <Div id = "error">  <p> system error ~~~, Contact the administrator! </P> <p> the homepage will be returned in <span id = "mes"> 5 </span> seconds </P> </div>

3. Configure the Web. config file
Add the <system. Web> label

<! -- Automatic orientation when an error occurs --> <customerrors mode = "on" defaultredirect = "~ /Error.htm "> </customerrors>

4. At this point, the error page is customized.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.