用URLRewriter进行伪静态配置,webconfig的配置如下:
代码
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/jifenmingxi.html</LookFor>
<SendTo>~/jifenmingxi.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/jifenmingxi_(\d).html</LookFor>
<SendTo>~/jifenmingxi.aspx?page=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<connectionStrings>
<add name="connstr" connectionString="server=192.168.0.*;uid=*;pwd=*;database=*;pooling=false;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--该配置对于伪静态很重要-->
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
</httpModules>
</system.web>
</configuration>
<configuration>
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/jifenmingxi.html</LookFor>
<SendTo>~/jifenmingxi.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/jifenmingxi_(\d).html</LookFor>
<SendTo>~/jifenmingxi.aspx?page=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<connectionStrings>
<add name="connstr" connectionString="server=192.168.0.*;uid=*;pwd=*;database=*;pooling=false;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--该配置对于伪静态很重要-->
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
</httpModules>
</system.web>
</configuration>