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:
- Create an error page in the project: error.html
- 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.