2

I have page i.e. Default.aspx. I can handle error pages like 404,403. But when I change the extention of page then server give me an error.If I change Default.aspx to Default.asasd. Here I have just changed the extention of page then server gives following error

Error Page

I added 404 error page in my web.config file. How can I solve this?

Web.config

    <customErrors mode="On" defaultRedirect="~/ErrorPages/DefaultErrorPage.aspx" redirectMode="ResponseRedirect">
        <error statusCode="404"  redirect="~/ErrorPages/404.aspx" />
        <error statusCode="403"  redirect="~/ErrorPages/403.aspx" />
   </customErrors>
2
  • how did you write your custom error pages in your web.config. paste the section. Commented Nov 26, 2012 at 6:50
  • Thank you for reply @AMember I added web.config in my question. Commented Nov 26, 2012 at 6:56

1 Answer 1

1

Add this:

<system.webServer>
    <httpErrors errorMode="Custom">
        <remove statusCode="404" />
        <error statusCode="404" path="/Error.aspx" responseMode="ExecuteURL" />
    </httpErrors>
</system.webServer>
Sign up to request clarification or add additional context in comments.

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.