ASP. NET MVC Error Routing default configuration

Source: Internet
Author: User

Problem Description: By default, MVC has configured the routing parameter settings, which is not explained here, please go to the garden search, there are many related articles. This is about an MVC project in which we enter an incorrect URL, or a URL that doesn't exist at all, such as: Http://localhost:6224/jeutcvmg/jfidjfijdif, which appears to be a hard-to-see, very unfriendly error page. You want it to jump to the specified page, the default home page, and so on, and reach the global response.

Key words: customErrors

Solve the explanation

1. Open <web.config>, find <system.web> node, add under Node

    <customErrorsMode= "On"defaultredirect= "~/home/error">      <ErrorStatusCode= "403"redirect= "~/home/unauthorizedaccess"/>      <ErrorStatusCode= "404"redirect= "~/home/filenotfound"/>    </customErrors>

2.mode has on, OFF, RemoteOnly and other modes, as the name implies; defaultredirect error default jump page routing;
Error when the project appears with the specified error code, the errors page is specified according to the route jump.

There are some other parameters, and then slowly groping it!

PS: Rookie Notes

ASP. NET MVC Error Routing default configuration

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.