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

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

How can I fix this?


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

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.