MVC Project Controller renamed, with the original page URL can not access, how to do?

Source: Internet
Author: User

Title. MVC Project, mobile website. The company's official, after the user concerned, click on the corresponding menu can use the relevant features.

Recent projects have been refactored, and some nonstandard naming methods have been reconstructed. On-line, found some Web pages can not be accessed.

Contact Maintenance maintenance Personnel inconvenient, then, how to modify our program can solve it?

The following workaround:

1. Web. config handlers

How to set it is not OK.

2. Global.asax, intercept request do jump, did not become.

3.RegisterRoutes, add Maproute to RouteCollection, get it done. Here's the code:

 Public Static voidregisterroutes (routecollection routes) {routes. Ignoreroute ("{Resource}.axd/{*pathinfo}"); //Note:defaultcontroller The original name of the Mailitemcontroller, I changed to Defaultcontroller afterhttp://localhost: 5120/mailitem/wpyjpage can't access it. Add the following routemap to it. (Note: The default route must be placed before "default")//As configured below, the valid Access form is:http://localhost: 5120/mailitem/wpyjpageroutes. MapRoute ("MailItem",//Route name        "Mailitem/{action}",//URL with Parameters        New{controller ="Default", action ="Vipservicepage"}//parameter Default value    ); //As configured below, the valid Access form is:http://localhost: 5120/default/wpyjpageroutes. MapRoute ("Default",//Route name        "{Controller}/{action}/{id}",//URL with Parameters        New{controller ="Default", action ="Vipservicepage", id = urlparameter.optional}//parameter Default value    ); ////As configured below, the valid Access form is:http://localhost: 5120/default/wpyjpage.htm    //routes. MapRoute (//"MailItem",//Route name//"{controller}/{action}.htm",//URL with Parameters//New {controller = "Default", action = "Vipservicepage"}//parameter Default value//);}

MVC Project Controller renamed, with the original page URL can not access, how to do?

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.