Asp. NET site pseudo-static use of Chinese URL method _ Practical skills

Source: Internet
Author: User

First of all explain, what is the Chinese URL? It is not our common way to put encoding as%CF%EC, but to use Chinese characters directly in the URL.

This form is not much seen at present. Because different browsers can be handled differently, I've tested that IE8 and Firefox are fully supported.

Its advantage is that you can use the link address to look very intuitive and understandable! Search engines are also supported.

First of all, my ASP.net web site's pseudo static, my files are at the end of. htm, is actually a dynamic ASP. The method is to map HTM to aspx files in the background.

Pseudo-static rules are defined in the Web.config file.

Form one:

http://www.jb51.net/Beijing. htm

Pseudo-Static code

<Rules>
<RewriterRule>
<lookfor>~/([^ Provinces to]+) [province | City]\.htm</lookfor>
<sendto >
<![ cdata[~/prov.aspx?provname=$1]]>
</SendTo>
</RewriterRule>
</Rules>

Form two:

http://www.jb51.net/Hubei/Hankou. htm

<Rules>
<RewriterRule>
<lookfor>~/([^/]+)/(\w+) \.htm</lookfor>
< Sendto>
<![ cdata[~/city.aspx?provname=$1&cityname=$2]]>
</SendTo>
</RewriterRule>
</ Rules>

The actual code processing is implemented in two background files, prov.aspx and city.aspx, but pseudo static completely hides this.

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.