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

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

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

                                          

 

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

        最后,就是配置站点下的“Web.config”文件了,具体的配置如下:

 <?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>  
      <add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter" />  
    </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 @ 2012-01-30 16:50  强哥  阅读(669)  评论(0)    收藏  举报