urlrewriting.net map all classic asp requests to default.aspx

667 views Asked by At

I'm using urlrewriting.net and want to add a rule to map all classic asp requests to default.aspx.

Unfortunately my attempt below just results in a redirect loop, so I must be doing something wrong.

    <add name="LegacyRedirect"
     virtualUrl="^~/(.*).asp"
     redirectMode="Permanent"
     redirect="Application"
     destinationUrl="~/default.aspx"/>

Many thanks, Ben

2

There are 2 answers

0
Ben Foster On BEST ANSWER

Seems I was missing $ at the end of my regular expression.

Below is what worked for me (redirects all asp requests to the site root):

    <add name="LegacyRedirect"
     virtualUrl="^~/([^?]*)\.asp$"
     redirectMode="Permanent"
     redirect="Application"
     destinationUrl="~/"/>
2
Tom Gullen On
<add name="LegacyRedirect"
     virtualUrl="^~/(.*).asp"
     redirectMode="Permanent"
     redirect="Application"
     destinationUrl="~/default.aspx"
     processing="stop"
/>

Try that. And put this rule before all others. Processing = stop means once the rule has been matched, it doesn't apply any other rules.

Also,

destinationUrl="~/default.aspx"

can probably just be:

destinationUrl="~/"