2006/02/20

收集:UrlRewritingModule w/ Regular Expression Support for ASP.NET 2.0


收集:UrlRewritingModule w/ Regular Expression Support for ASP.NET 2.0
src:http://weblogs.asp.net/scottgu/archive/2006/01/18/435870.aspx

tags:urlrewrite,urlrewriting,url转向,.net,regularExpression
查看我的mail无意中看到这个,虽然这个功能一年前我就开始用了
,不过没有文中提到的那么细致
唉!看来自己的东西就是没有大家的东西用起来好啊,先收集与此,有空的时候再对比一下以前的程序

scottgu 的原文

UrlRewritingModule w/ Regular Expression Support for ASP.NET 2.0

Here is a really cool URL rewriting module for ASP.NET 2.0.  You can configure it using regular expressions in your web.config file like so:

< urlrewritingnet

  rewriteOnlyVirtualUrls= "true"

  contextItemsPrefix= "QueryString"

  compileRegex= "true"

  xmlns= " http://www.urlrewriting.net/schemas/config/2006/01 " >

 

  < rewrites >

    < add virtualUrl ="^~/(.*)/Detail(.*).aspx"

         rewriteUrlParameter= "ExcludeFromClientQueryString"

         destinationUrl= "~/Default.aspx?language=$1&amp;id=$2 "

         ignoreCase= "false"/>

    < add virtualUrl ="^~/(.*)/(.*).aspx"

         rewriteUrlParameter= "StoreInContextItems"

         destinationUrl= "~/$2.aspx?language=$1&amp;parameter=$2 &amp;dasistso=schoen"

         ignoreCase= "true" />

  </ rewrites >

 

</ urlrewritingnet>

You can download both the source code and a compiled binary from here.  Very cool and handy!

- Scott

 

posted on Wednesday, January 18, 2006 3:34 PM



--
[:p] --fallseir.lee

没有评论: