Custo404Redirect Error iis8

Posted by Community Admin on 05-Aug-2018 11:07

Custo404Redirect Error iis8

All Replies

Posted by Community Admin on 05-Mar-2014 00:00

Hi,

Custom404 Redirecting is Successfully Redirecting in local system, But its not Working in Server(windows server 2012, IIS8),

Here is my code:

<customErrors mode="On" defaultRedirect="~/not-found">
<error statusCode="404" redirect="~/custom404" />
<error redirect="~/not-found" statusCode="403"/>
</customErrors>

Please help me how to Solve this,Here I'm Attaching Error Screen Shot,

Thanks & Advance

Ajay

Posted by Community Admin on 07-Mar-2014 00:00

Hello Ajay,

The <customErrors> section handles only the ASP.NET errors. When you host your site on IIS you also need to configure the IIS to return your custom error pages whenever it encounters an http error on your site.

In order to configure the IIS error handling you need to add the following code under the <system.webServer> section in the web.config file:

<system.webServer>
...
 
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="false"/>     
    <httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
      <remove statusCode="404" />
      <error statusCode="404" path="/custom404" responseMode="Redirect" />
    </httpErrors>
...
</system.webServer>

You can also take a look at the following article for additional information on http errors.

Regards,
Sabrie Nedzhip
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items

Posted by Community Admin on 03-Sep-2014 00:00

I am having a similar issue with the custom error pages. I can get them to redirect, but how do I get them to return a 404 status code? Right now the page is returning a 200 status code with the bad urls. 

<customErrors mode="RemoteOnly" defaultRedirect="~/error/generic.aspx">
        <error statusCode="403" redirect="~/error/403.aspx" />
        <error statusCode="404" redirect="~/error/404.aspx" />
          <error statusCode="500" redirect="~/error/500.aspx" />
    </customErrors>
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
            <remove statusCode="404" />
            <error statusCode="404" path="/error/404.aspx" responseMode="ExecuteURL" />
        </httpErrors>

This thread is closed