Analysis of ASP. NET configuration error page

Source: Internet
Author: User
From: http://developer.51cto.com/art/200908/141782.htm

ASP. NET configuration error pages may face many problems during website operation, such as server errors and the page requested by the user does not exist,ProgramConfiguration errors and other issues. Some default system error pages will appear when a user requests to browse the webpage. This is unfriendly to the user and unfriendly to the search engine.

Here we know some common HTTP status codes for Seo:

◆ 404: the server cannot find the specified resource and the requested webpage does not exist (for example, the webpage requested by the browser is deleted or moved, but it does not rule out the possibility that the link will be valid in the future );

◆ 410: the requested webpage does not exist (Note: 410 indicates permanent, and 404 indicates temporary );

◆ 200: the server returns the requested webpage successfully;

◆ 301: Permanent website redirection

◆ 302: temporary website redirection

In the search engine's view, the most important error is the 404 error, which indicates that the webpage does not exist. When a user enters the next page of your domain name that does not exist, the search engine determines that the HTTP Error does not exist. If there are too many such errors, the search engine will be punished.

ASP. NET configuration error page solution:

You can set the 404 page in IIS.

But. Net has this better practice. In the system. web of Web. config, you only need to add

  
  
  1. <Customerrors defaultredirect =& Quot; 404. aspx & quot"Mode ="On">
  2.  
  3. <Error statuscode ="404"Redirect =& Quot; 404. aspx & quot"/>
  4.  
  5. </Customerrors>

This can be written in ASP. net3.5.

  
  
  1. <Customerrors defaultredirect =& Quot; 404. aspx & quot"Redirectmode ="Responserewrite"Mode ="On">
  2.  
  3. <Error statuscode ="404"Redirect =& Quot; 404. aspx & quot"/>
  4.  
  5. </Customerrors>

If the redirectmode attribute is set to responseredirect, the user is redirected to the error page and the original URL is changed to the URL of the error page. If the redirectmode attribute is set to responserewrite, the user is directed to the error page without changing the original URL in the browser.

In this way, you can customize your own ASP. NET configuration error page.

The relevant operations on the ASP. NET configuration error page are introduced here. We hope to introduce you to the specific operations on the ASP. NET configuration error page.

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.