一,具体web.config文件怎么配置
第一步,在配置文件configSections结点中添加下面配置
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
第二步,在httpModules结点内添加下面配置
<!--配置url重写指定具体的处理组件-->
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
第三步,在modules 结点添加runAllManagedModulesForAllRequests属性
<modules runAllManagedModulesForAllRequests="true">
第四步,在modules结果添加以下配置
<!--您的自定义IIS重写模块操作-->
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/>
到现在为止,你的Intelligencia.UrlRewriter重写组件就可以成功在iis7中使用了。
二,具体怎么配置重写规则可以参照下面的:
重写HTML的规则示例:
(1)
注意:
当使用通配符映射或者使用ASP.NET处理所有HTTP请求的时候,IIS的默认文档机制也就失去了该有的作用,以下代码就是用来重新实现默认文档的方法:
<rewrite url="^(.*)/(\?.+)?$" to="$1/default.aspx$2" />注意:使用“processing="restart"”的时候将会导致重写引擎从头开始执行所有的重写规则,此时应当注重包含“