Reputation: 319
I placed thin on my web.config file
<customErrors mode="On" defaultRedirect="~/ErrorPages/Oops.aspx">
<error statusCode="404" redirect="~/ErrorPages/PageNotFound.html" />
</customErrors>
to redirect my custom 404 page not found on the file above. But its not working.
Do I need to add other configurations and code to make this work? Am I missing something? That's the only configuration I did.
Upvotes: 0
Views: 35
Reputation: 1485
try this code
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Auto" >
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="404" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
<error statusCode="500" path="/ErrorPage.aspx" responseMode="Redirect" />
</httpErrors>
</system.webServer>
Upvotes: 0
Reputation: 167
you must add custom error to system.web like this:
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="err.aspx">
<error statusCode="403" redirect="403.aspx" />
<error statusCode="404" redirect="404.aspx" />
</customErrors>
Upvotes: 1