在IIS7下,利用Intelligencia.UrlRewriter进行URLReWrite

不同于IIS6的配置,此处稍有不同!
当然大家想知道在II6下的配置,大家可以直接上官方网站,有详细的帮助文档,这里只是简单的说明一下在Windows 7下的IIS7里的配置方法。

首先,还是要打开一下IIS7,对需要URLReWrite的站点进行配置:

 

 

如图,打开应用程序池,找到需要设置的站点,将“托管模式”设置为集成!

最后,就是配置站点下的“Web.config”文件了,具体的配置如下:
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?> 
 
<configuration> 
  <configSections> 
    <!--UrlRewriter--> 
    <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" /> 
  </configSections> 
 
  <!--UrlRewriter--> 
  <rewriter> 
    <rewrite url="~/ShowNews/(\d+).html$" to="~/ShowNews.aspx?id=$1" processing="stop" /> 
    <rewrite url="~/product/(\d+).html$" to="~/ShowProduct.aspx?id=$1" processing="stop" /> 
  </rewriter> 
 
  <system.web>   
    <!--UrlRewriter Windows 2003 IIS 6 Config Setting--> 
    <!--<httpModules> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter" /> 
&nbsp;&nbsp;&nbsp;&nbsp;</httpModules>--> 
  </system.web> 
  <system.webServer> 
    <!--UrlRewriter Windows 7 II7 Config Setting--> 
    <modules> 
        <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="" /> 
    </modules> 
  </system.webServer> 
      
</configuration> 

文件里已经有注释了,就不多说了,呵呵!就这么简单!

posted @ 2011-07-06 12:50  永不放弃-Jack wu  阅读(392)  评论(0编辑  收藏  举报