如何理解Intelligencia.UrlRewriter.dll aspx重写为html实例
更新:HHH   时间:2023-1-7


本篇文章为大家展示了如何理解Intelligencia.UrlRewriter.dll aspx重写为html实例,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

1、http://urlrewriter.net/  下载解压缩后把Intelligencia.UrlRewriter.dll 文件添加引用到web工程里。

2.web.config配置:

<configSections>
  <!--UrlRewriter-->
  <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
 </configSections>

<system.web>
  <!--UrlRewriter-->
  <httpModules>
   <add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter" />
        </httpModules>
</system.web>
 </system.web>

 <!--UrlRewriter-->
 <rewriter>
  <rewrite url="~/test_([a-zA-Z]+).html$" to="~/Show.aspx?Code=$1" processing="stop" />
 </rewriter>

其中: <rewrite url="~/test_([a-zA-Z]+).html$" to="~/Show.aspx?Code=$1" processing="stop" />

若果code= abc的话,最终显示的结果为"虚拟目录名称/test_abc.html" 。如果吧.html替换成 .aspx那就是"虚拟目录名称/test_abc.aspx"

3.IIS配置:
如果是用"虚拟目录名称/test_abc.aspx" 的话,不需要配置IIS. 使用了"虚拟目录名称/test_abc.html" 配置IIS的方法如下:
http://urlrewriter.net/index.php/support/installation/windows-server-2003/ 里面的图9不准确,准确的为:

还有第八步中的”untick Verify that file exists.“要看仔细。否则重写HTML就无效。

4:备注

不要在"应用程序扩展"里“添加" .html的映射,否则正常的html将无法访问。

上述内容就是如何理解Intelligencia.UrlRewriter.dll aspx重写为html实例,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注天达云行业资讯频道。

返回开发技术教程...