2

I've got custom errors to work for .aspx page like: www.domain.com/whateverdfdgdfg.aspx

But, when no .aspx url is requested, (like http://www.domain.com/hfdkfdh4545) it results in an error:

HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

I have this in my web.config:

<customErrors mode="On" defaultRedirect="/error/1" redirectMode="ResponseRedirect">
  <error statusCode="404" redirect="/404.aspx" />
</customErrors>

404.aspx exists, since the above DOES work when requesting non-existent .aspx pages...

I also configured the errorpages in IIS7: Status code: 404 Path: /404.aspx Type: Execute URL Entry type: Local

My websites application pool setting is "ASP.NET v4.0"

Now why is this still not working?

1

1 Answer 1

2

Have you tried setting the following?

<system.webServer>
  <httpErrors existingResponse="PassThrough" />
</system.webServer>

Here are a couple of references on error pages:

http://www.iis.net/ConfigReference/system.webServer/httpErrors

http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.