1下载URLRewriter.dll到项目的bin目录中
2包含引用(反正我做了,可能非必要)
3在web.config,不要是web.debug.config中进行如下设置
<configuration>--------------------------------------------------------
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
</configSections>
--------------------------------------------------------------------------------------------
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/(\d+)</LookFor>
<SendTo>~/webform1.aspx?classid=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/(\d+)/(\d+)</LookFor>
<SendTo>~/webform1.aspx?classid=$1&id=$2</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
在 <system.web>上面----------------------------------
在 <system.web>里面---------------------------------------
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>
</httpHandlers>
<httpModules>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
</httpModules>
注意:
~/(\d+)/(\d+)中的斜杠数量