Rss Feed Like Us on facebook Google Plus

June 15, 2013

Setup Custom Error Page for 404 Page Not Found :ASP.NET

To set up custom error page in Asp.net.simply you have to just add a custom error code in
web.config file for aspx pages.and for Non aspx pages like html,php,jsp or only strings after url, you have to add httperrors code to web.config file.

 >> Add below codes in <configuration> Tag in web.config

For Aspx Pages

<system.web>
    <customErrors defaultRedirect="404.aspx" mode="On">
      <error  redirect="404.aspx" statusCode="404" />
    </customErrors>
  </system.web>



For Non-Aspx pages

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


you can design your 404 page using these links
http://www.smashingmagazine.com/2009/01/29/404-error-pages-one-more-time/

© 2011-2016 Techimpulsion All Rights Reserved.


The content is copyrighted to Tech Impulsion and may not be reproduced on other websites.