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

Forums / Bugs & Issues / Sitefinity 404 handling

Sitefinity 404 handling

11 posts, 0 answered
  1. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    18 Feb 2009
    Link to this post
    Hi,

    I recently upgraded to Sitefinity 3.6, where I was hoping to see a certain 404-handling issue fixed per these notes I found here:

    - [14124] Fixed problem with redirects when an extension different than that of the original page is inserted under Page URLs
    - Implemented extensionless URLs and “404 Not Found” improvements


    In particular, the 2nd item.  Take this scenario: I have the Sitefinity 404-handling page (/sf404.aspx) specified as the 404 handler in IIS, and I have a custom 404 handling page that I created (/error/404.aspx) specified as the 404 handler in my web.config customErrors element.  In this case:

    1. Going to a nonexistent, non-aspx page (i.e. http://localhost:188/fweatw/wegawgawg/ewgawge/wgeage/testat.html) just gives me the generic "File not found" page, whereas going to a nonexistent .aspx page sends me to my custom 404 page (/errors/404.aspx).

    2. Extensionless URL redirection (i.e. http://localhost:188/schools/arizona) works.  This is, presumably, handled by sf404.aspx.

    In an attempt to fix the first issue, I switched IIS to use my 404 handling page (/errors/404.aspx).  This resulted in:

    1. Going to a nonexistent, non-aspx page (i.e. http://localhost:188/fweatw/wegawgawg/ewgawge/wgeage/testat.html) takes me to my custom 404 page, as does a nonexistent .aspx page.  So that is fixed.

    2. Extensionless URL redirection (i.e. http://localhost:188/schools/arizona) doesn't work.  So this is obviously handled by sf404.aspx.

    For now, I have stuck with the 2nd scenario (my custom 404 page being used in IIS), and written a stored procedure, to be called on my custom 404 page, which handles extensionless URL redirection manually by traversing the sf_PageBase table in the Sitefinity database.

    I was hoping to see this issue fixed in 3.6 per this thread.  Is this issue not something that was covered by the "extensionless URLs and 404 Not Found improvements?"
  2. Randy
    Randy avatar
    19 posts
    Registered:
    13 Nov 2007
    20 Feb 2009
    Link to this post
    John,  we had the same issue and got around it.  I posted the work-around here
    Make sure you read both posts. The second post points out an error in the first post.

  3. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    20 Feb 2009
    Link to this post
    Hello Randy,

    Thank you for taking a part in the discussion. These issues can be fixed indeed with the threads you pointed out.
    We have done some improvements of the 404 errors handling for the upcoming hotfix.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    20 Feb 2009
    Link to this post
    Thanks.

    From what I gather in that post (and correct me if I'm wrong), it seems to me that it only solves cases where we can explicitly specify that a particular URL (i.e. contact.htm) should redirect elsewhere (i.e. contact.aspx). In other words, it solves the non-aspx issue, but:

    1. Only for extensions (i.e. .htm) which you explicitly specify in IIS, and

    2. Only in cases in which you have explicitly defined an incorrect URL (contact.htm) and a redirect URL (contact.aspx) in Sitefinity. If I go to "/ewfewf/fewfew/fewf/fewfew/fwefw/wefwe/test.htm", I'm still going to get the canned white 404 page.

    This is, of course, if I have /sf404.aspx specified as my 404 handler in IIS.  Which, again, is necessary in order for extensionless URL redirection (amongst pages in the Sitefinity database) to work properly.
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    24 Feb 2009
    Link to this post
    Hi John,

    We are not sure what you mean. Could you please give us a concrete scenario? Also, do you use some url rewriting in your project?

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    25 Feb 2009
    Link to this post
    My original post in this thread was a pretty accurate depiction of the scenario(s) I am actually facing.  To recap:

    First scenario: /sf404.aspx is specified as the 404 handler in IIS, and /errors/404.aspx (my custom 404 handling page) is specified as the 404 handler in the customErrors section of web.config.

    1. Going to a non-existent, non-aspx page on my site (i.e. http://mymachine:188/eawf/efawefawef/wefawe/ewfae/fwefw/fwefw.html) takes me to the generic "File Not Found" page.  This is a problem.

    2. Going to a non-existent .aspx page on my site (i.e. http://mymachine:188/eawf/efawefawef/wefawe/ewfae/fwefw/fwefw.aspx) sends me to my custom 404 page (/errors/404.aspx) as expected.

    3. Extensionless URL redirection (i.e. http://mymachine:188/schools/arizona redirecting to http://mymachine:188/schools/arizona/home.aspx) for Sitefinity-created pages works.  This is handled by /sf404.aspx.

    Second scenario: /errors/404.aspx (my custom 404 handling page) is specified as the 404 handler in the customErrors section of web.config, AS WELL AS the 404 handler in IIS.

    1. Going to a non-existent, non-aspx page on my site (i.e. http://mymachine:188/eawf/efawefawef/wefawe/ewfae/fwefw/fwefw.html) takes me to my custom 404 page, as expected.

    2. Going to a non-existent .aspx page on my site (i.e. http://mymachine:188/eawf/efawefawef/wefawe/ewfae/fwefw/fwefw.aspx) sends me to my custom 404 page (/errors/404.aspx) as expected.

    3. Extensionless URL redirection (i.e. http://mymachine:188/schools/arizona redirects to http://mymachine:188/schools/arizona/home.aspx) for Sitefinity-created pages DOES NOT work, because it is handled by /sf404.aspx.  In order to get this to work, I wrote a stored procedure to traverse the sf_PageBase table in the Sitefinity database and do this redirection manually.

    I understand the ASP.NET ISAPI reasons, detailed in this post, which are causing this, but that same post also mentioned the issue being fixed in 3.6.

    So what I am saying is, URL rewriting (and similar solutions via the Sitefinity interface, such as the one that was originally posted by Randy in response to my first post) is aimed at me saying "when somebody goes to this particular URL, send them to this other URL."  On the other hand, I want to say, "when someone goes to ANY nonexistent URL on my site, send them here (meaning my custom 404 page)."  Meanwhile, I want to keep /sf404.aspx as the 404 handler in IIS because I want the extensionless URL redirection to work without having to manually decipher the Sitefinity database.
  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    07 Mar 2009
    Link to this post
    Hi John,

    Thank you very much for the complete description of the problem.
    We will investigate all of these scenarios next week, and will definitely try improve this functionality for the upcoming SP. We will follow up to this thread as well, if we find something.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Herman
    Herman avatar
    6 posts
    Registered:
    22 Jun 2009
    15 Oct 2009
    Link to this post
    I have the same problem with V3.7 SP1 and had hoped it had been solved. My problem in short:

    We use extensionless urls setup:
     - In IIS 6 the 404 is set to /sf404.aspx
     - In web.config custom errors 404 is set to ~/nl/Home/NietGevonden

    Every not found url should show the ~/nl/Home/NietGevonden page no matter what url it is but none shows our custom error page. Extensionless urls work ok.

    When we disable the "show friendly errors" in IE we get an error when a 404 should be displayed: 'The system cannot find the file specified.'

    Any tips?
  9. Stoyanka Assenova
    Stoyanka Assenova avatar
    113 posts
    Registered:
    01 Dec 2016
    20 Oct 2009
    Link to this post
    Hello Herman,

    Have you set mode attribute equal to "On" in custom errors section in the web.config file?

    <customErrors mode="On">
          <error redirect="~/Sitefinity/nopermissions.aspx" statusCode="403" />
          <error redirect="~/Group/test" statusCode="404" />
    </customErrors>

    Have you set your virtual directory in URL address for sf404.aspx page in IIS? You can take a look at the attachment that illustrates the panel from where you should set the url in IIS..

    Best wishes,
    Stoyanka Assenova
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. Herman
    Herman avatar
    6 posts
    Registered:
    22 Jun 2009
    21 Oct 2009
    Link to this post
    Yes i have. The problem is partly solved now:
     
    /nl/Home works due to IIS 404 /sf404.aspx configuration
    /nl/Home.aspx also works
    /nl/Home.sf404.aspx also works
    /nl/Homa.aspx throws an application exception and is handled by the Custom Errors section and is capturable in the global.asax. This works as it should now
    /nl/Homa does not throw any exception and is not handled bij Custom Errors section. It only shows a tekst error : "The system cannot find the file specified."

    There seems to be something wrong in the sf404 handling with non existing pages.....    
  11. Stoyanka Assenova
    Stoyanka Assenova avatar
    113 posts
    Registered:
    01 Dec 2016
    26 Oct 2009
    Link to this post
    Hello Herman,

    Unfortunately, we cannot reproduce this problem locally with the latest Sitefinity version (Sitefinity 3.7 SP1, version - 2022).

    Please, could you send URL address for your project and  credential to login in your project, and screenshot for sf404.aspx page in IIS to email address: stoyanka.assenova@telerik.com.

    Thank you for your cooperation in advance.

    Sincerely yours,
    Stoyanka Assenova
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
11 posts, 0 answered