Idrees Khan
Idrees Khan

Reputation: 7752

Convert URLs into Regular Expression

i am using Intelligencia.UrlRewriter.dll in asp.net for url re-writting, but i don't know about regular expressions. Is there anyone who could help me out convert these urls into regular expression.

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

VendorID could be changed as well as CategoryID.

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

similarly ProductID could be changed. I actually want to write regular expression for these query string in web.confg file such as

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

And One lastthing, is there any best url-rewriter other than this?.

Upvotes: 0

Views: 1822

Answers (1)

Sam Greenhalgh
Sam Greenhalgh

Reputation: 6136

Your question is very unclear, and as others have pointed out. Is this what you are trying to do?

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

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

Upvotes: 1

Related Questions