下载地址:download.microsoft.com/download/0/4/6/0463611e-a3f9-490d-a08c-877a83b797cf/MSDNURLRewriting.msi
解压过后,得到URLRewriter.dll
第一步:
添加URLRewriter.dll到bin目录下(URLRewriter.pdb也要复制)
第二步:配置:web.config
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/dd/index/.html</LookFor>
<SendTo>~/index.aspx</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<httpHandlers>
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
<LookFor>伪静态地址</LookFor>
<SendTo>程序地址</SendTo>
这样,你运行,就可以了,假如你的地址是http://localhost:2256/default3.aspx
你可以运行http://localhost:2256/dd/index.html
哈哈,可以了吧,不过,当你点击里面的按钮或者什么的分页时候,页面又回到原先了
解决办法
第三步:添加你下载好的(还是在bin目录下)ActionlessForm.dll,ActionlessForm.pdb这两个文件
然后在你的default3.aspx页面的顶部添加
<%@ Register TagPrefix="ask" Namespace="ActionlessForm" Assembly="ActionlessForm"%>
如果有<form>则替换为
<ask:Form id="Form1" method="post" runat="server">
不要忘了</ask:Form>
哈哈,可以了,试试吧!!!!