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

Forums / Deployment / Configuring 404 Page

Configuring 404 Page

8 posts, 0 answered
  1. Neil
    Neil avatar
    30 posts
    Registered:
    20 Jan 2009
    12 Apr 2011
    Link to this post
    Hi folks,

    I've deployed a site where I had some intricate 404 page processing, and ultimately had to roll it back due to issues with the references being created. What I'm trying to do now is create a simple static 404 page (error.htm) that I would like to have returned by IIS7 for all 404 errors. I've got it set up, and it works for non aspx pages. I noticed that IIS7 says the app is running in classic mode and that custom errors will apply to anything but aspx. My question is how do I get this applying to aspx pages as well? I swapped the app pool to using integrated mode, and that didn't seem to change the behaviour at all. 

    Thanks in advance for your assistance.
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    02 Dec 2016
    12 Apr 2011
    Link to this post
    Hello Neil,

     Do you mind taking a look at this forum thread which contains a long discussion concerning custom error redirection. In the latest replies I've provided a short video showing how to set this properly in IIS and it should handle both pages with and without extension. Please try the proposed solution and inform me if the problems persist. Any additional information concerning the exact settings you have made, and maybe a screenshot/short video showing how the problem reproduces will be very useful.

    Best wishes,
    Boyan Barnev
    the Telerik team

  3. Neil
    Neil avatar
    30 posts
    Registered:
    20 Jan 2009
    19 Apr 2011
    Link to this post
    Sorry about the delays responding here. I had set up the 404 to custom errors, and specified my simple html page that I wanted displayed. In the web.config it translates to: 

    <customErrors mode="RemoteOnly">
                <error redirect="~/Sitefinity/nopermissions.aspx" statusCode="403" />
                <error redirect="/Error.htm" statusCode="404" />
            </customErrors>

    The redirect picks up for all non-aspx pages, but not actual aspx pages. I haven't bothered to check it either for friendly url links.
  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    02 Dec 2016
    19 Apr 2011
    Link to this post
    Hello Neil,

    The forum post was quite long, sorry if you got misled by the initial discussions offering usage of customerrors. The proper way is to set custom error handling in IIS - did you review this sample video showing how to set custom errors in IIS. Please try with it and tell me if you are still experiencing problems.

    Kind regards,
    Boyan Barnev
    the Telerik team

  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    03 Apr 2012
    Link to this post
    Hey Boyan,
      Quick question on this...this doesn't work on a single view control filter, any "easy" way around that?  Like to the user this:
    /ug/mf/4/cases/aj-singhai is a page, but in reality this /ug/mf/4/cases/ is the page, and the content item is aj-singhai.  So putting like a "2" on the end or something to make it invalid gives this, which is a 404 status code in firebug.

    Server Error in '/' Application.

    Page not found

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Page not found

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): Page not found]
       Telerik.Sitefinity.Web.PageRouteHandler.handler_PreRenderComplete(Object sender, EventArgs e) +861
       System.EventHandler.Invoke(Object sender, EventArgs e) +0
       System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +121
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1155
    


    Steve
  6. Paul
    Paul avatar
    18 posts
    Registered:
    14 Jan 2011
    17 Apr 2012
    Link to this post
    Hi Boyan,

    I followed the instructions given in the video and it all worked well. However, I have the following problem now:

    I used Google Webmaster tools to Crawl our page and it returns a lot of crawl errors now. The thing is, we used to have a page in PHP and google still knows about those pages. Of course they do not work anymore, so we have a lot of dead links. When I access those links, I get the 404 error page displayed that I have configured BUT - that is my problem now - google does not get a 404 or 410 statuscode from that page and gets 200 instead. So, for google that page is still there but it redirects to to my error page of course and that is a normal working page for Google.

    Do I need to change the web.config or is there another solution to this?

    Cheers
    Patrik
  7. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    17 Apr 2012
    Link to this post
    @Paul,
      Weird, what code does fiddler give you?
  8. Paul
    Paul avatar
    18 posts
    Registered:
    14 Jan 2011
    17 Apr 2012
    Link to this post
    Steve, thanks for your response. Fiddler is getting the same (HTTP/1.1 200 OK).

    I've had a go with the web.config and it looks something like this:

    <system.webServer>
              <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true" />
            <httpErrors errorMode="Custom">
                <remove statusCode="500" subStatusCode="-1" />
                <remove statusCode="404" subStatusCode="-1" />
                <error statusCode="404" prefixLanguageFilePath="" path="/error-pages/404" responseMode="ExecuteURL" />
                <error statusCode="500" prefixLanguageFilePath="" path="/error-pages/500" responseMode="ExecuteURL" />
                <error statusCode="410" prefixLanguageFilePath="" path="/error-pages/410" responseMode="ExecuteURL" />
            </httpErrors>
    </system.webServer>


    And there is the commented part 
    <customErrors mode="Off"></customErrors>
        <!--
                The <customErrors> section enables configuration
                of what to do if/when an unhandled error occurs
                during the execution of a request. Specifically,
                it enables developers to configure html error pages
                to be displayed in place of a error stack trace.
     
            <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->

    Cheers



    EDIT
    Also, when I play around with those settings, I suddenly do get a 500 error response AND even though I have set it up in IIS and it is the web.config it does not display my custom 500 error page.
    EDIT II
    Also, we run on Sitefinity 4.3 incl. Hotfix




Register for webinar
8 posts, 0 answered