Let the URL of asp.net MVC look like a traditional WebForm URL

Source: Internet
Author: User

It must be known that asp.net MVC was deployed on the IIS6, and in order for IIS to send requests for asp.net mvc to asp.net processing, the application ISAPI mappings have to be added.

One way to avoid this mapping is to take advantage of existing mappings, such as the mappings of. aspx extensions. But in that case asp.net MVC's URL would be "ugly" and "http://localhost/ASPNETMVCAPP/Account.aspx/Logon/". If you can put the. aspx to the end of the URL above, it will be "good-looking" a lot, "http://localhost/ASPNETMVCAPP/Account/Logon/default.aspx". And it looks more like a traditional WebForm URL.

It is not difficult to achieve such a function. The following settings can be made in Global.asax.cs when the URL route mapping.

This is the URL effect of the implementation:

This is the modification made in the Default.aspx.cs of the application.

The advantage of this is that it looks like a webform has a certain degree of deception, but also keep the url "Beautiful", the URL to the middle of the ASPX page is not real, perhaps more secure. It is also possible to remove ISAPI registrations in IIS6, which is convenient for virtual host users.

Related Article

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.