Introduction to constructing ASP. net4.0 friend URL

Source: Internet
Author: User

What is a friend URL? It is actually a friendly URL format. Let's call it like this.

In ASP. net mvc, URL is subject to route control, and you can rewrite the URL without any settings. This ensures that the URL is concise and clear!

In the ASP. NET project, we used to rewrite the page url, so we had to expand an httphandler with a big deal, and then matched it with a regular expression.

Rewriter is used to rewrite the URL!

Now let's try to build our own friend URL reasonably and quickly in ASP. NET!

Official reference: http://msdn.microsoft.com/zh-cn/library/cc668201.aspx

Based on what is officially provided, we isolate the content to be rewritten in the global. CS file and store it through the XML file.

1. Configure the node for the page where the URL needs to be rewritten in the site

Name indicates routename

To represents the rewritten address.

From physical path of the page before standard Rewriting

2. Rewrite the global. CS registerroutes function.

3. effect Preview

I hope you can give me more advice when writing blogs for the first time. Thank you !!

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.