Pseudo static web.config configuration step

  • 2020-05-19 04:33:48
  • OfStack

 
<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<!-- The first 1 Step registered url Rewrite module into webconfig One of the most top --> 
<configSections> 
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" /> 
</configSections> 
<!-- The first 2 Step add override rule --> 
<RewriterConfig> 
<!-- Write the entire rewrite rule first --> 
<Rules> 
<!-- Set rules for each individual page --> 
<RewriterRule> 
<!-- Original request address --> 
<SendTo><![CDATA[~/news.aspx?id=$1&pid=$2]]></SendTo> 
<!-- The rewritten address --> 
<LookFor>~/news/(.[0-9]*)/(.[\d]*)\.html</LookFor> 
</RewriterRule> 
<RewriterRule> 
<!-- Original request address --> 
<SendTo><![CDATA[~/product.aspx?pid=$1]]></SendTo> 
<!-- The rewritten address --> 
<LookFor>~/product/(.[\d]*)\.zangdalei</LookFor> 
</RewriterRule> 
</Rules> 
</RewriterConfig> 
<system.web> 
<compilation debug="false" targetFramework="4.0"> 
<!-- The first 4 The ministry of url Overwriting prevents real pages from being overwritten as well. If a real page exists in a web site, you need to add a build directive that does not compile real pages html file --> 
<buildProviders> 
<add extension=".html" type="System.Web.Compilation.PageBuildProvider" /> 
</buildProviders> 
</compilation> 
<!-- The first 3 The ministry of url rewrite   Pass the user's request page to the appropriate handler, paying attention to the request's 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> 
<defaultDocument> 
<files> 
<clear /> 
<add value="default.aspx" /> 
<add value="default.html" /> 
</files> 
</defaultDocument> 
</system.webServer> 
</configuration> 

Related articles: