Custom Error 404 does not work after upgrade

  • Updated

After you upgrade to 9.00 SP2 CU20, 9.10, or 9.10 SP1, pages that previously generated a custom 404 error now generate a file not found message.

  1. Locate your site's web.config file in your site root folder.
  2. Find the <system.web> tag.

Add the following code before the closing tag and replace pathtocustomerrorpage.aspx with the path to your actual custom error page):

 

 

<customerrors mode="On" redirectmode="ResponseRedirect" defaultredirect="~/pathtocustomerrorpage.aspx"> 
<error statuscode="404" redirect="~/pathtocustomerrorpage.aspx"></error> 
</customerrors>

NOTE: You already may have a customer error section, which you should modify accordingly.

  1. Find the <system.webserver> tag.
  2. Add the following before the closing tag:
<httperrors errormode="Custom">; 
<remove statuscode="404"></remove> 
<error statuscode="404" path="/404redirect.aspx" responsemode="ExecuteURL"></error> </httperrors>

NOTE: Alternatively, you could change to  to let you see the error on the CMS server itself, which can be helpful in debugging>

  1. Save the web.config file.
  2. Open C:\Windows\System32\inetsrv\config\applicationhost.config .
  3. Find the element
    <section name="httpErrors" overrideModeDefault="Allow"></section> 
  4. Make sure that the value of overrideModeDefault  is allow
  5. Place the 404redirect.aspx file in your site root. The file can be located here .
  6. Edit the 404redirect.aspx file.
  7. Find the line of code that reads: string errorTemplate = "/pathtocustomerrorpage.aspx" .
  8. Edit the line by replacing pathtocustomerrorpage.aspx with the name of your custom 404 template located in your site root directory.
  9. Save the modified 404redirect.aspx .
  10. Re-evaluate the site's behavior.