+1-888-365-2779
Try Now
More in this section

Forums / Deployment / Custo404Redirect Error iis8

Custo404Redirect Error iis8

3 posts, 0 answered
  1. Ajay
    Ajay avatar
    46 posts
    Registered:
    14 Nov 2013
    05 Mar 2014
    Link to this post

    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

  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    02 Dec 2016
    07 Mar 2014
    Link to this post
    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
  3. Jeremy
    Jeremy avatar
    33 posts
    Registered:
    22 Apr 2010
    03 Sep 2014 in reply to Sabrie Nedzhip
    Link to this post

    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>

3 posts, 0 answered