Copy codeThe Code is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<! -- Register the url rewriting module in the top part of webconfig -->
<ConfigSections>
<Section name = "RewriterConfig" type = "URLRewriter. Config. RewriterConfigSerializerSectionHandler, URLRewriter"/>
</ConfigSections>
<! -- Step 2 add Rewrite Rules -->
<RewriterConfig>
<! -- Create all rewrite rules first -->
<Rules>
<! -- Create rules for each individual page -->
<RewriterRule>
<! -- Original request address -->
<SendTo> <! [CDATA [~ /News. aspx? Id = $1 & pid = $2]> </SendTo>
<! -- Rewrite address -->
<LookFor> ~ /News/(. [0-9] *)/(. [\ d] *) \. html </LookFor>
</RewriterRule>
<RewriterRule>
<! -- Original request address -->
<SendTo> <! [CDATA [~ /Product. aspx? Pid = $1]> </SendTo>
<! -- Rewrite address -->
<LookFor> ~ /Product/(. [\ d] *) \. zangdalei </LookFor>
</RewriterRule>
</Rules>
</RewriterConfig>
<System. web>
<Compilation debug = "false" targetFramework = "4.0">
<! -- The fourth part of url rewriting prevents real pages from being overwritten. If the website contains real pages, you need to add compilation instructions to not compile real html files. -->
<BuildProviders>
<Add extension = ". html" type = "System. Web. Compilation. PageBuildProvider"/>
</BuildProviders>
</Compilation>
<! -- The third part is url rewriting. the user's request page is handed over to the corresponding handler. Pay attention to the request suffix format. -->
<HttpHandlers>
<Add verb = "*" path = "*. html" type = "URLRewriter. RewriterFactoryHandler, URLRewriter"/>
<Add verb = "*" path = "*. zangdalei" type = "URLRewriter. RewriterFactoryHandler, URLRewriter"/>
</HttpHandlers>
</System. web>
<System. webServer>
<Handlers>
<Add name = "aspnethtml" path = "*. html "verb =" GET, POST "modules =" IsapiModule "scriptProcessor =" C: \ Windows \ Microsoft. NET \ Framework \ v4.0.30319 \ aspnet_isapi.dll "resourceType =" Unspecified "preCondition =" classicMode, runtimeVersionv4.0, bitness32 "/>
<Add name = "aspnetzangdalei" path = "*. zangdalei "verb =" GET, POST "modules =" IsapiModule "scriptProcessor =" C: \ Windows \ Microsoft. NET \ Framework \ v4.0.30319 \ aspnet_isapi.dll "resourceType =" Unspecified "preCondition =" classicMode, runtimeVersionv4.0, bitness32 "/>
</Handlers>
<Defadocument document>
<Files>
<Clear/>
<Add value = "default. aspx"/>
<Add value = "default.html"/>
</Files>
</Defadocument document>
</System. webServer>
</Configuration>