Benefits and methods of asp.net url rewriting

Source: Internet
Author: User

Benefits of url rewriting:

1. Easy to search by the search engine (html-format website search engines have the highest priority, and seo optimization is better)

2. the url is simpler and easier to remember.

3. Hide the actual website path strength and specific development technologies

Use URLRewriter. dll to override

After URLRewriter. dll is used, you only need to use the following steps to rewrite the url.

1. Write in webconfig

Copy codeThe Code is as follows: <Rules>
<! -- Rule 1 -->
<RewriterRule>
<LookFor> ~ /D (\ d +) \. html </LookFor>
<SendTo> ~ /Default. aspx? Id = $1 </SendTo>
</RewriterRule>
</Rules>

Page display is ~ /Default. aspx? Id = 5, auto or converted ~ /D5.html, which is restricted by regular expressions.

2. Configure httpmodel

Copy codeThe Code is as follows: <Add type = "URLRewriter. ModuleRewriter, URLRewriter" name = "ModuleRewriter"/>
</HttpModules>

Windows2003 Server Configuration:
Website> Properties> directory> Configuration (G)> ing> wildcard application ing> insert
Executable File: C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_isapi.dll
Check whether the file exists: No

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.