Hi,
I'm doing url rewriting with the help of the Regex class. In my web.config file I have my rewrite rules specified. However,
I have a lot of them as I have a dynamic storefront. Here's a sample:
<Urls>
<add key="/Shoes/-pg(\d+)\.aspx" value="/Shoes/Default.aspx?pg =$1"/>
<add key="/Shoes/-t(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1"/>
<add key="/Shoes/-t(\d+)-pg(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1&pg=$2"/>
<add key="/Shoes/-t(\d+)-s(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1&s=$2"/>
<add key="/Shoes/-t(\d+)-s(\d+)-pg(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1&s=$2& ;pg=$3"/>
........ many more follow but are vastly different ........
</Urls>
Fortunately, these rules work like a charm. But I was wondering if I could somehow consolidate this sample into one or two
rules with the use of regular expressions.
It took me a while to get this working as I don't quite understand regular expressions correctly, so could someone out there
help me?
Thanks,
Roshawn
I'm doing url rewriting with the help of the Regex class. In my web.config file I have my rewrite rules specified. However,
I have a lot of them as I have a dynamic storefront. Here's a sample:
<Urls>
<add key="/Shoes/-pg(\d+)\.aspx" value="/Shoes/Default.aspx?pg =$1"/>
<add key="/Shoes/-t(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1"/>
<add key="/Shoes/-t(\d+)-pg(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1&pg=$2"/>
<add key="/Shoes/-t(\d+)-s(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1&s=$2"/>
<add key="/Shoes/-t(\d+)-s(\d+)-pg(\d+)\.aspx" value="/Shoes/Default.aspx?t= $1&s=$2& ;pg=$3"/>
........ many more follow but are vastly different ........
</Urls>
Fortunately, these rules work like a charm. But I was wondering if I could somehow consolidate this sample into one or two
rules with the use of regular expressions.
It took me a while to get this working as I don't quite understand regular expressions correctly, so could someone out there
help me?
Thanks,
Roshawn