Ben Foster
Ben Foster

Reputation: 34800

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

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

Upvotes: 1

Views: 668

Answers (2)

Ben Foster
Ben Foster

Reputation: 34800

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="~/"/>

Upvotes: 2

Tom Gullen
Tom Gullen

Reputation: 61725

<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="~/"

Upvotes: 2

Related Questions