网上的方法都试了,
先、我们要用到URL重写组件:URLRewriter.rar
其次、需要在WEB.CONFIG里面进行些设置:
1、在Web.Config的<system.web>和</system.web>添加以下节点:
<httpHandlers>
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
2、在Web.Config的<configuration>和</configuration>添加以下节点:
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections><RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/d(\d+)\.html</LookFor>
<SendTo>~/Default.aspx?MyID=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
设置完以上两个步骤,就基本可以运行了,其中<RewriterRule/>标签里面就是重写的一个模块,<LookFor/>里面的是重写后的地址,而<SendTo/>则是原地址。
3、配置IIS解析.html文件
IIS配置:网站->属性->虚拟目录->配置(G)...->映射->通配符应用程序映射->添加
可执行文件:c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
扩展名为:.html
确认文件是否存在:不选.
都是差不多相关的方法。还有直接安装isapi_rwl_x86_0067.msi来配置的,都试了,不行,麻烦各位了,为什么网上的方法在实际中只需要配置一个web.config文件加添加引用,在我这里不能实现,
服务器windows2003 sp2 IIS6.0 .net2.0
关于asp.net中的url重写的问题,组件urlrewriter_dll
最新推荐文章于 2021-07-31 00:17:43 发布