2012-02-19 199 views
0

我在asp.net中使用Intelligencia.UrlRewriter.dll进行URL重写,但我不知道正则表达式。有没有人可以帮助我将这些网址转换为正则表达式。将URL转换为正则表达式

http://localhost:50788/catalog.aspx?VendorID=1&CategoryID=1 

VendorID可以和CategoryID一样改变。

http://localhost:50788/Product.aspx?ProductID=1 

类似ProductID可以更改。 其实我想写正则表达式中web.confg文件如

<!-- Rewrite department pages --> 
    <rewrite url="/Index" to="~/Default.aspx" /> 

,一个lastthing这些查询字符串,有没有比这以外的任何最好的网址重写?

+1

什么意思是“将URL转换为正则表达式”?也许你应该阅读正则表达式是什么? – 2012-02-19 18:22:47

+0

我的意思是,我需要能够支持写入URL的正则表达式(比如上面)。 – 2012-02-19 19:43:45

回答

1

你的问题很不明确,正如其他人指出的那样。这是你想要做的吗?

new Regex(@"http://localhost:50788/catalog\.aspx\?VendorID=\d+&CategoryID=\d+"); 

new Regex(@"http://localhost:50788/Product\.aspx\?ProductID=\d+"); 
+0

我实际上试图在web.confg文件中编写正则表达式,例如 2012-02-22 14:34:50

相关问题