Use URL mapping techniques in asp.net2.0 to change URLs __.net

Source: Internet
Author: User

What's the use of URL mapping?

Take a more practical example, such as you develop a blog site, each blog home page loading address is

Www.xxjishu.cn/Default.aspx?id=anckly

The default page chooses to load the user's blog content by ID. But you need your users. You can access his blog as soon as you enter www.blog.com/anckly. This can be achieved by using the URL mapping in asp.net2.0.

The principle of implementation is URL mapping by configuring the Web site Web.config file. <!--URL mapping-->
< urlmappings enabled = "true" >
< add URL = "~/anckly" mappedurl = "~/default.aspx?id=anckly"/>
</urlmappings >

The first step is to set the Enabled property of the urlmappings to true. This allows the site to map the URL.

The next step is to set the mapping path. The URL represents a user-entered Url,mappedurl representing the URL of the Web page that the server is actually receiving.

Back to the first question, you can add an Add node for urlmappings after each user registers (the implementation principle refer to the System.Configuration namespace), store each user's URL mapping path.

Another use of URL mapping is to hide the real page path, providing a certain security for the site.

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.