asp.net实现伪静态

来源:互联网 发布:施琅大将军知乎 编辑:程序博客网 时间:2024/05/16 12:13

 

webconfig伪静态<system.web> <httpHandlers>    <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>    <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>   </httpHandlers></system.web><configuration><RewriterConfig>   <Rules>    <RewriterRule>     <LookFor>~/r_(.[/d]*).html</LookFor>     <SendTo>~/readbook.aspx?xd=$1</SendTo>    </RewriterRule>    <RewriterRule>     <LookFor>~/(.[/d]*)_(.[/d]*).html</LookFor>     <SendTo><![CDATA[~/bookpage.aspx?cid=$1&xd=$2]]></SendTo>    </RewriterRule>    <RewriterRule>     <LookFor>~/page(.[/d]*)_(.[/d]*).html</LookFor>     <SendTo><![CDATA[~/bookstore.aspx?page={0}&page1=$1&page2=$2]]></SendTo>    </RewriterRule>    <RewriterRule>     <LookFor>~/page_b(.[/d]*).html</LookFor>     <SendTo><![CDATA[~/bookstore.aspx?page={0}&page2=$1]]></SendTo>    </RewriterRule>   </Rules></RewriterConfig></configuration>需要注意的是需要在internet管理中IIS配置添加C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/aspnet_isapi.dll,并且把扩展名修改为:.html,,,,是否检查文件的选择勾掉 
原创粉丝点击