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

Forums / Bugs & Issues / manual 404 causes sf404 error

manual 404 causes sf404 error

4 posts, 0 answered
  1. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    18 Dec 2009
    Link to this post
    I'm not sure if this is a bug or if I'm just doing this wrong...

    I have a usercontrol which shows an item details based on the id specified in a query string.

    if the query string is not passed, or if the item does not exist, I want to override the control to throw a 404 error, because the page should technically not exist (since there is no such item). However, when I do this, the sf404 handler takes my page and tries to find it by appending .aspx to it. Since the page DOES exist, and it already HAS the .aspx extension, this seems like incorrect behavior.

    here's more details:

    the page is items.aspx, but you have to access it with something like items.aspx?id=99

    if the item is found, no problem.

    however if the item number doesn't exist, or if you just access via items.aspx, I want to return status code 404, because that page should not exist.

    If I access the page items.aspx, I get redirected through the 404 handler, BUT when I'm debugging at look at the url being accessed, it now shows items.aspx.aspx which is not found.

    even stranger, this doesn't seem limited to my custom page. If I go to any non-existant page, it's redirecting me to 404.aspx.aspx

    i fixed this by changing the error in web.config to redirect to "404" instead of "404.aspx" but somehow I feel like I must be doing something completely wrong...
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    19 Dec 2009
    Link to this post
    Hello SelArom,

    Have you set the web.config pageExtension property to empty string? If it is set without the .aspx extension (which is by default), then we will not append any .aspx at the end. 

    <cms defaultProvider="Sitefinity"
     pageExtension=""
     additionalExtensions=".asp, .html, .do"
     disabled="false"
     pageEditorUIMode="Overlay"
     redirectToHomePage="false">

    Let me know if you get different results though.

    Best wishes,
    Georgi
    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.
  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    19 Dec 2009
    Link to this post
    but we do want the extention, will setting it empty break the aspx links?
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Dec 2009
    Link to this post
    Hello SelArom,

    Yes, it will break the links - they will not be resolvable. I think the entire case is strange, even without setting an empty value for the pageExtension, you should not get such case. 

    Try setting pageExtension to empty string, and additionalExtensions to contain ".aspx". 

    Greetings,
    Georgi
    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
4 posts, 0 answered