Add reference urlrewriter. DLL to the bin directory of the project, and download the package/files/jaylong/msdnurlrewriting.zip from Microsoft.
1. Configure nodes under <configsections> of the <configuration> node in the web. config file
<! -- Configure the rewrite rule node -->
<Section name = "rewriterconfig" type = "urlrewriter. config. rewriterconfigserializersectionhandler, urlrewriter"/>
2. write rewrite rules in the <configuration> node range class
<! -- Rewrite Rules -->
<Rewriterconfig>
<Rules>
<Rewriterrule>
<Lookfor> ~ /Web/New/(. [0-9] *) \. aspx </lookfor>
<Sendto> ~ /Web/New. aspx? Id = $1 </sendto>
</Rewriterrule>
<Rewriterrule>
<Lookfor> ~ /Index.html </lookfor>
<Sendto> ~ /Default. aspx </sendto>
</Rewriterrule>
<Rewriterrule>
<Lookfor> ~ /Show _ ([0-9] * cmd.html </lookfor>
<Sendto> ~ /Show. aspx? Id = $1 </sendto>
</Rewriterrule>
</Rules>
</Rewriterconfig>
3. Configure
<Add verb = "*" Path = "*. aspx" type = "urlrewriter. rewriterfactoryhandler, urlrewriter"/>
<Add verb = "*" Path = "*. html" type = "urlrewriter. rewriterfactoryhandler, urlrewriter"/> <! -- If this node is not added, HTML pages cannot be targeted. -->
4. Enter index.html in the browser and access the default. aspx page.
Export show_2.html actually accesses show. aspx? Page with ID = 2
Download all source code:/files/jaylong/website1.zip