Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday 22 April 2016

How to add 404 Page not Found custom error in web config in asp.net

Add below code to  web.config:


    <customErrors defaultRedirect="~/PageError.aspx"
                 mode="On">
      <error statusCode="500"
             redirect="~/PageError.aspx"/>
      <error statusCode="404"
           redirect="~/PageNotFound.aspx"/>
    </customErrors>
If you found HTTP 404.0-File not Found

then add you have to add more code given below:

<system.webServer>
    <httpErrors errorMode="Custom" >
      <remove statusCode="404" subStatusCode="-1"/>
      <error statusCode="404" path="~/PageNotFound.aspx" responseMode="Redirect"  />
    </httpErrors>
  </system.webServer>

1 comment: