利用URLRewriter重写url 实现伪静态

下载URLRewriter  的地址
download.microsoft.com/download/0/4/6/0463611e-a3f9-490d-a08c-877a83b797cf/MSDNURLRewriting.msi 

现在伪静态都实现。。 在网上也看到 不少说法。。。说是伪静态  消耗资源 占用CPU   我也搞不明白 说法是否真实。也希望各发表下 意见

我简单的说下   利用URLRewriter  实现 伪静态吧 ~

配置文件里 要

<configuration>
  
<configSections>
    
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
  
</configSections>

</configuration>

<section name="RewriterConfig" 
type
="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>

<httpHandlers>
      
<add verb="*" path="*.html"
           type
="URLRewriter.RewriterFactoryHandler, URLRewriter" />
   
</httpHandlers>

将文件扩展名为 .html 的文件的所有 HTTP 请求映射到类。。注意不是请求的ASPX  是 HTML

然后 开始重写 一样 要在配置文件里 加

Code

以上采用了 来 匹配你的文件路径变量。
操作很简单。。。 其原理 主要 运用了 httpHandlers 这样的处理文件类。。
posted @ 2009-07-25 18:02  稳扎稳打  Views(240)  Comments(0)    收藏  举报