0

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.

2 Answers 2

1

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>

Sign up to request clarification or add additional context in comments.

2 Comments

It did not redirect.
i set this mode remotey only you must set it in On
0

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>

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.