web.config中urlrewrite重写规则存储在xml,请问调用?
最好给出示例代码,谢谢!

解决方案 »

  1.   

    还得在iis上部署一下,
    然后写到这个文件里你需要重写的页面:
    IisUrlRewriter.ini# 
    # The set of rewrite rules in this file is partially for illustration, and
    # partially for filtering ad requests.  I also have a hosts file that
    # redirects known ad servers to my local machine, as per
    # http://www.mvps.org/winhelp2002/hosts.htm . 
    #
    # This rewrite rule file redirects the ad requests to the local machine, to a
    # "filtered.htm" file.  You drop the "filtered.htm"  into c:\inetsrv\wwwroot and
    # you can put anything you like into the filtered.htm  file.  It will display for 
    # every filtered ad. 

    # Wed, 13 Apr 2005  09:54# 每行前面加#号即为注释
    # 如果启用RewriteLog则生成日志文件
     RewriteLog  c:\temp\iirfLog.out
    RewriteLogLevel 3# MaxMatchCount
    #
    # Specifies the maximum number of sub-expression matches to
    # capture for a single pattern. This specifies the size of the
    # array in the C module.  If you have a pattern with more than
    # the default number of matches, set this number.
    #
    # The default is 10. MaxMatchCount 10
    #Start dznt URL Rewrite settings
        .*    RewriteRule ^/college/([0-9]+)\.html$  /College/Index.Aspx?CollegeID=$1
        RewriteRule ^/College/([0-9]+)\.html$  /College/Index.Aspx?CollegeID=$1
        RewriteRule ^/college/news([0-9]+)\.html$  /college/news_class.aspx?news_classid=$1
        RewriteRule ^/college/news([0-9]+)p([0-9]+)\.html$  /college/news_class.aspx?news_classid=$1&page=$2
        RewriteRule ^/college/([0-9]+)_([0-9]+)_([0-9]+)\.html$  /college/News_Show.Aspx?NewsID=$1&NewsClassID=$2&CollegeID=$3
        RewriteRule ^/college/v([0-9]+)_([0-9]+)\.html$  /college/College_NewsView.Aspx?CollegeID=152&NewsClassID=14
        #新闻 大写
        RewriteRule ^/News/([0-9]+)p([0-9]+)\.html$  /News/News_Class.Aspx?News_ClassID=$1&page=$2
        RewriteRule ^/News/([0-9]+)c([0-9]+)\.html$  /News/News_Class.Aspx?News_ClassID=$1&cityid=$2
        RewriteRule ^/News/([0-9]+)c([0-9]+)p([0-9]+)\.html$  /News/News_Class.Aspx?News_ClassID=$1&cityid=$2&page=$3
        RewriteRule ^/News/([0-9]+).html$  /News/News_Class.Aspx?News_ClassID=$1
        RewriteRule ^/News/([0-9]+)_([0-9]+)\.html$  /News/News_Show.Aspx?NewsID=$1&NewsClassID=$2
        #新闻 小写
        RewriteRule ^/news/([0-9]+)p([0-9]+)\.html$  /News/News_Class.Aspx?News_ClassID=$1&page=$2
        RewriteRule ^/news/([0-9]+)c([0-9]+)\.html$  /News/News_Class.Aspx?News_ClassID=$1&cityid=$2
        RewriteRule ^/news/([0-9]+)c([0-9]+)p([0-9]+)\.html$  /News/News_Class.Aspx?News_ClassID=$1&cityid=$2&page=$3
        RewriteRule ^/news/([0-9]+).html$  /News/News_Class.Aspx?News_ClassID=$1
        RewriteRule ^/news/([0-9]+)_([0-9]+)\.html$  /News/News_Show.Aspx?NewsID=$1&NewsClassID=$2
        #新闻 结束
        #设置college的URL重写
        #新闻 二
          #新闻 大写
        RewriteRule ^/News/([0-9]+)p([0-9]+)\.html$  /News/News_ClassTo.Aspx?News_ClassID=$1&page=$2
        RewriteRule ^/News/([0-9]+)c([0-9]+)\.html$  /News/News_ClassTo.Aspx?News_ClassID=$1&cityid=$2
        RewriteRule ^/News/([0-9]+)c([0-9]+)p([0-9]+)\.html$  /News/News_ClassTo.Aspx?News_ClassID=$1&cityid=$2&page=$3
        RewriteRule ^/News/([0-9]+).html$  /News/News_ClassTo.Aspx?News_ClassID=$1
        RewriteRule ^/News/([0-9]+)_([0-9]+)\.html$  /News/News_ShowTo.Aspx?NewsID=$1&NewsClassID=$2
        #新闻 小写
        RewriteRule ^/news/([0-9]+)p([0-9]+)\.html$  /News/News_ClassTo.Aspx?News_ClassID=$1&page=$2
        RewriteRule ^/news/([0-9]+)c([0-9]+)\.html$  /News/News_ClassTo.Aspx?News_ClassID=$1&cityid=$2
        RewriteRule ^/news/([0-9]+)c([0-9]+)p([0-9]+)\.html$  /News/News_ClassTo.Aspx?News_ClassID=$1&cityid=$2&page=$3
        RewriteRule ^/news/([0-9]+).html$  /News/News_ClassTo.Aspx?News_ClassID=$1
        RewriteRule ^/news/([0-9]+)_([0-9]+)\.html$  /News/News_ShowTo.Aspx?NewsID=$1&NewsClassID=$2
        
        RewriteRule ^/college/city([0-9]+).html$  /college/college_class.aspx?cityid=$1
        RewriteRule ^/college/city([0-9]+)p([0-9]+).html$  /college/college_class.aspx?cityid=$1&page=$2
        RewriteRule ^/college/class([0-9]+).html$  /college/college_class.aspx?classid=$1
        RewriteRule ^/college/class([0-9]+)p([0-9]+).html$  /college/college_class.aspx?classid=$1&page=$2    #college设置完成
        #画室
        RewriteRule ^/school/([0-9]+).html$  /school/List.Aspx?cityid=$1
        RewriteRule ^/school/([0-9]+)p([0-9]+).html$  /school/List.Aspx?cityid=$1&page=$2
        RewriteRule ^/school/v_([0-9]+).html$  /school/Index.Aspx?ID=$1
        RewriteRule ^/school/v1_([0-9]+).html$  /school/vip1.Aspx?ID=$1
        RewriteRule ^/school/v2_([0-9]+).html$  /school/vip2.Aspx?ID=$1
        RewriteRule ^/school/v3_([0-9]+).html$  /school/vip3.Aspx?ID=$1
        RewriteRule ^/college/class([0-9]+).html$  /college/college_class.aspx?classid=$1
        RewriteRule ^/college/class([0-9]+)p([0-9]+).html$  /college/college_class.aspx?classid=$1&page=$2
        
        #画室结束
        #End dznt URL Rewrite settings
    # This is a sample unparsed rule.  Anything that is not
    # understood by the INI file grammar is meaningless, and is
    # logged but otherwise ignored by Ionic's ISAPI Rewrite Filter (IIRF).NotParsed  foo bar
      

  2.   

    URLRewriter.dll
    http://www.cnblogs.com/T_98Dsky/archive/2005/08/25/222992.html
    更强的
    ISAPI_Rewrite
    http://kb.discuz.net/index.php?title=ISAPI_Rewrite%E7%9A%84%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%BF%E7%94%A8
      

  3.   

    还是有点不明白
    我是说把web.config里面urlrewrite规则单独写到一个指定的xml文件中,怎么调取这个xml文件的规则