0

I'm migrating an ASP.NET app from IIS6 to IIS7 and in doing this I'm also porting my rewrite settings from Intelligencia.UrlRewriter to using IIS rewriting.

In have some problems with "Rejected-By-Urlscan" errors (urls like /åäö.html should be redirected to my 404 page).

In Intelligencia.UrlRewriter this worked:

<rewrite url="^~/Rejected-By-UrlScan" to="~/sidan-finns-inte.html"/>

I ported this to:

  <rule name="Rejected-By-UrlScan">
    <match url="^Rejected-By-UrlScan" />
    <action type="Rewrite" url="/sidan-finns-inte.html" />
  </rule>

But I keep gettings IIS internal 404 error instead of my 404 error (sidan-finns-inte.html).

How can I fix this?

1

I solved it by adding:

   <httpErrors errorMode="Custom">
      <remove statusCode="404" subStatusCode="-1" />
      <error statusCode="404" path="/404.aspx" responseMode="ExecuteURL" />
      <remove statusCode="500" subStatusCode="-1" />
      <error statusCode="500" path="/Error.aspx" responseMode="ExecuteURL" />
    </httpErrors>

In Web.Config

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.