Reputation: 4697
This works and it redirects to yahoo.com as desired:
<httpErrors errorMode="Custom">
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" path="http://www.yahoo.com" responseMode="Redirect" />
</httpErrors>
This doesn't, and the difference is that I'm specifying a page in my app rather than an external URL:
<httpErrors errorMode="Custom">
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" path="/ErrorPages/401.aspx" responseMode="ExecuteURL" />
</httpErrors>
The error I get on the screen is:
XML Parsing Error: no element found
Location: http://localhost/app/MyPage.aspx
Line Number 1, Column 1:
The status code of this error (seen via Firebug) is 403. When I actually browse to /app/ErrorPages/401.aspx using a browser, I see the error page just fine.
I'm using Visual Studio 2012, with the app deployed in IIS7 as a Virtual Directory through VS.
I looked at all the available docs. Any idea what I'm missing?
Upvotes: 0
Views: 466
Reputation: 10843
If you're using a virtual directory you need to include the virtual directory path in the path
attribute if it is not an absolute URI.
Upvotes: 2