在项目中,之前公司是使用IIS 7.0官方的URL重写模块,官方的使用说明请参见官方URLRewrite  ,添加伪静态支持,后来经理问我有没有涉及伪静态,我说之前项目中我一直是用Intelligencia.UrlRewriter,我觉得它蛮好用的,然后我就按领导的意思换成这个,我以为这东西最多半个小时就搞定的事情,我之前都是在IIS 6.0上配置的。找过一些资料发现是webconfig中,多加两个配置。我在此记录下来。以便今后使用。

1、在modules 结点添加runAllManagedModulesForAllRequests属性

<modules runAllManagedModulesForAllRequests="true">

2、然后在modules结果添加以下配置

<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/>

下面完整的介绍下配置步骤:

一、配置webconfig

第一步:在配置文件configSections结点中添加下面配置:

<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>

第二步:在httpModules结点内添加如下配置

<!--配置url重写指定具体的处理组件-->

<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter"/>

第三步:在modules 结点添加runAllManagedModulesForAllRequests属性

<modules runAllManagedModulesForAllRequests="true">

第四步:在modules结果添加以下配置

<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/>

重写规则的配置:有两种配置,一种是直接写在webconfig中,一种是写到一个xml中

1、在webconfig中的配置:

<rewriter>
<rewrite url="~/default.html$" to="~/default.aspx" processing="stop" />
<rewrtie url="^~/(\d+)/(\d+).html" to="~/Default.aspx?id=$1&amp;artcleid=$2" />//多个参数 </rewriter>

2、写到一个xml文件中,这样需要的webconfig指定到xml中

如:

<!--地址重写规则-->
<rewriter file="~/xml/config/rewrite.xml"/> rewrite.xml中的内容如下: <?xml version="1.0" encoding="utf-8" ?>
<rewriteRules>
<!--注册日志监视器-->
<register logger="Intelligencia.UrlRewriter.Logging.DebugLogger, Intelligencia.UrlRewriter" />
<!--begin 网站首页 --> <rewrite url="~/index.html" to="~/Price_index.aspx" />
<!--end 网站首页 -->
<!--begin 新闻列表1(新闻类型) -->
<rewrite url="~/newslist/([^/]*)/?$" to="~/price_newlist.aspx?type=$2" />
<!--end 新闻列表1(新闻类型) -->
<!--begin 新闻列表2(含分页) -->
<rewrite url="~/newslist/([^/]*)-(\d{1,3})/?$" to="~/price_newlist.aspx?type=$1&amp;page=$2" />
<!--end 新闻列表2(含分页) -->
</rewriteRules>

到此介绍完毕,也许大家可能在用到这个的时候会遇到一个问题,那就是项目中本身的html文件无法访问,下次我为大家一一介绍解决办法。看到有需要用到的就参考下。

这篇文章是在2012-06-09发表在csdn上的。点击查看

Intelligencia.UrlRewriter在IIS 7.0下的完全配置攻略的更多相关文章

  1. Windows下LATEX排版论文攻略—CTeX、JabRef使用介绍

    Windows下LATEX排版论文攻略—CTeX.JabRef使用介绍 一.工具介绍 TeX是一个很好排版工具,在学术界十分流行,特别是数学.物理学和计算机科学界. CTeX是TeX中的一个版本,指的 ...

  2. linux下安装apache与php;Apache+PHP+MySQL配置攻略

    1.apache   在如下页面下载apache的for Linux 的源码包    http://www.apache.org/dist/httpd/;   存至/home/xx目录,xx是自建文件 ...

  3. IIS 7.0 下 httpMoudle 失效的问题

    在web.config里配置了: <system.web> <httpModules>  <add type="DevExpress.Web.ASPxClass ...

  4. [整理]IIS 6.0 下部署 Asp.net MVC Web Api 后 HTTP PUT and DELETE 请求失败

    http://guodong.me/?p=1560 ASP.NET MVC 4 has a new feature called WebAPI which makes it much easier t ...

  5. vc++ 6.0下Glut的配置 及 Glut 框架介绍

    2014-04-08  16:18:30 一.配置Glut 学习来源: http://blog.sina.com.cn/s/blog_5f0cf7bd0100c9oa.html 亲测可行. Glut的 ...

  6. Kali 2.0 下 Metasploit 初始化配置

    在kali 2.0中,命令行中直接输入msfconsole 提示不能连接到数据库 ,是由于postgresql 未启动.因此,需要开启postgresql,并且进行postgresql 的初始化配置. ...

  7. ArcGIS Server 10.0 安装及使用完整攻略

    引言 ArcGIS Server 10.0在使用和安装的过程中,需要进行比较全面的学习,才能正确使用.缺乏正确的指引,用户很容易在安装及使用中遇到问题.所以笔者在此总结Server 10.0的安装及使 ...

  8. cloudstack4.2+xenserver6.0.2 详细配置攻略

    搭建一台安装了XenServer的服务器 搭建一台安装了CloudStack的服务器用以管理云平台 可以使用CloudStack云平台进行虚拟机管理 使用远程桌面访问windows虚拟机 由于最近实验 ...

  9. Windows下TEX排版论文攻略—CTeX、JabRef使用心得

    笔者刚刚接触到TEX排版,相关知识完全空白,用了两天时间学习并完成了一篇论文的完整排版. 期间遇到不少小问题,着实辛苦,分享至上,现将其解决办法总结归纳,共同学习.     一.工具介绍 TeX是一个 ...

随机推荐

  1. Target:IG

    https://www.zhihu.com/question/25525630 别人轻轻松松红名,我拼死挣扎才1700+分. 仔细想想,虽然我在这东西上花了太多的精力,可是我根本没有认真学.做题全靠抄 ...

  2. (转)Array.prototype.slice.call自解

    很多框架或者库里面都会有这句的使用,最多的还是通过Array.prototype.slice.call(arguments,0)把arguments这个伪数组转换为真正的数组.但为什么可以这么做,却一 ...

  3. 纯JavaScripst的全选、全不选、反选 【转】

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. Leetcode SortList

    Sort a linked list in O(n log n) time using constant space complexity. 本题利用归并排序即可 归并排序的核心是将两部分合成一部分, ...

  5. ACM: HDU 5418 Victor and World - Floyd算法+dp状态压缩

    HDU 5418 Victor and World Time Limit:2000MS     Memory Limit:131072KB     64bit IO Format:%I64d & ...

  6. There was an internal API error.

    1.一开始以为是用了 iOS8的API, 抱着不相信的态度,我搜到了一条原因,可能是没有选择对开发者账号或需要 cmd+shift+k 来 clean 一下,无效. 2.又继续盯着这个问题,才发现我的 ...

  7. iphone H5 input type="search" 不显示搜索 解决办法

    H5 input type="search" 不显示搜索 解决办法 H5 input type="search" 不显示搜索 解决方法 在IOS(ipad iP ...

  8. 找到一个Flex中LineChart很好的学习博客

    http://blog.flexexamples.com/category/linechart/ 里面链接复制的时候失效了,请直接点击原页面进行查看 Setting specific minimum ...

  9. Spring MVC和Struts2的比较的优点

    Spring MVC和Struts2的区别: 机制:spring mvc的入口是servlet,而struts2是filter(这里要指出,filter和servlet是不同的.以前认为filter是 ...

  10. Perform UPSERT / INSERT OR UPDATE against a SQLite Database

    Option 1: You can afford deleting the row In other words, you don't have foreign key, or if you have ...