2012-02-19 200 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

相關問題