邪恶的URLRewriter重写

 

 

 

代码
<section name="CustomConfiguration" type="URLRewriter.Config.UrlsSection, URLRewriter" />


<httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload"/><add type="URLRewriter.RewriterModule, URLRewriter" name="RewriterModule"/></httpModules>
<httpModules>
<add type="URLRewriter.RewriterModule, URLRewriter" name="RewriterModule"/>
</httpModules>

 

正则表达式是亮点 

 

 

<CustomConfiguration>
 <urls>
 <!--<add virtualUrl="~/def*.*" destinationUrl="~/default.aspx?id=$1" />-->
 
 
 <!--<add virtualUrl="~/([a-zA-Z]{4.16})\.aspx" destinationUrl="~/hotnews.aspx?id=$1" />-->
 
 
 <!--<add virtualUrl="~/m/i/c/rosoft.aspx" destinationUrl="~/default.aspx" />
 <add virtualUrl="~/m/i/c/rosoft.aspx" destinationUrl="~/default.aspx" />-->
 <add virtualUrl="~/([^/]+)/?" destinationUrl="~/stuuser/feedback.aspx?id=$1" />
 </urls>
 
 </CustomConfiguration>

 

代码
<CustomConfiguration>
<urls>
<!--<add virtualUrl="~/def*.*" destinationUrl="~/default.aspx?id=$1" />-->


<!--<add virtualUrl="~/([a-zA-Z]{4.16})\.aspx" destinationUrl="~/hotnews.aspx?id=$1" />-->


<!--<add virtualUrl="~/m/i/c/rosoft.aspx" destinationUrl="~/default.aspx" />

<add virtualUrl="~/m/i/c/rosoft.aspx" destinationUrl="~/default.aspx" />-->

<add virtualUrl="~/([^/]+)/?" destinationUrl="~/stuuser/feedback.aspx?id=$1" />
</urls>

</CustomConfiguration>

 

 

 

([^/]+)/?(.*)  直接截取D里面的值

  (\d+).html 数字静态

posted @ 2010-03-31 15:02  回忆的颜色  阅读(278)  评论(0编辑  收藏  举报