利用URLRewriting.dll实现asp.net页面伪静态!(不用安装Rewriter)

configuration>                       
 <configSections>           
  <!-- The <configSections> element must contain a <section> tag for the <RewriterConfig> section element.
    The type of the section handler is RewriterConfigSerializerSectionHandler, which is responsible for
      deserializing the <RewriterConfig> section element into a RewriterConfig instance... -->
  <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
 </configSections>     
 <RewriterConfig>               
  <Rules>     
   
   <RewriterRule>
    <LookFor>~/index.html</LookFor>
    <SendTo><![CDATA[~/index.aspx]]></SendTo>
   </RewriterRule>
   <RewriterRule>
    <LookFor>~/blog/Article/(\d+).html</LookFor>
    <SendTo><![CDATA[~/blog/Article/ArticleView.aspx?id=$1]]></SendTo>
   </RewriterRule>
   <RewriterRule>
    <LookFor>~/blog/Pic/(\d+).html</LookFor>
    <SendTo><![CDATA[~/blog/Pic/PicView.aspx?id=$1]]></SendTo>
   </RewriterRule>
   
   <RewriterRule>
    <LookFor>~/Album/(\d+).html</LookFor>
    <SendTo><![CDATA[~/Album/Html/list_$1.html]]></SendTo>
   </RewriterRule>
   
   <RewriterRule>
    <LookFor>~/Search/Search.html</LookFor>
    <SendTo><![CDATA[~/Search/Search.aspx]]></SendTo>
   </RewriterRule>-->
   
   <!-- Reg
   <RewriterRule>
    <LookFor>~/Member/RegisterTerm.html</LookFor>
    <SendTo><![CDATA[~/Member/RegisterTerm.aspx]]></SendTo>
   </RewriterRule>
   <RewriterRule>
    <LookFor>~/Member/RegisterAccount.html</LookFor>
    <SendTo><![CDATA[~/Member/RegisterAccount.aspx]]></SendTo>
   </RewriterRule>-->
   
   <!-- Meet
   <RewriterRule>
    <LookFor>~/Meet/index.html</LookFor>
    <SendTo><![CDATA[~/Meet/index.aspx]]></SendTo>
   </RewriterRule>-->
   
   <!-- Good
   <RewriterRule>
    <LookFor>~/Good/index.html</LookFor>
    <SendTo><![CDATA[~/Good/index.aspx]]></SendTo>
   </RewriterRule>-->
  </Rules>
 </RewriterConfig>
 <system.web>
  <!--Ajax-->
  <httpHandlers>
   <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro" />
  </httpHandlers>
  <httpModules>
   <!-- 地址改写 -->
   <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />
   

 

1     以上内容写到web.config里面   然后URLRewriting.dll文件放到bin目录里面  

2.  然后iis配置里面添加一个html的拓展名,文件指向.net的文件 ,就是和asp.net的拓展名的文件一样

利用URLRewriting.dll实现asp.net页面伪静态!(不用安装Rewriter)_第1张图片

 

 利用URLRewriting.dll实现asp.net页面伪静态!(不用安装Rewriter)_第2张图片

 

这样就完成url重写 ,就不需要安装isapi rewrite那么麻烦了

你可能感兴趣的:(html,.net,asp.net,Path,IIS)