Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • trfletch 595 posts 571 karma points
    Oct 12, 2012 @ 18:55
    trfletch
    0

    Redirecting to node before it is fully published error - No umbraco document matches the url

    Hi All,

    I am running a Umbraco 4.7.2 website that is using a heavily modified version of the nForum package. I didn't post this in nForum section because I don't think my issue is relevant to the package. Basically the issue I am having is when I create a new topic which should create a node then redirect to it, I sometimes (not everytime) get the following error:

    Page not found

    No umbraco document matches the url 'http://www.mysite.co.uk/forum/2012/10/forum-topic.aspx'

    If I was then to refresh the page it would show correctly. It is almost as if the page redirects to the new node before it has actually been created. My site is using Examine, not sure if this could have any impact on the issue. Does anyone know if there is a way to get around this? Could I put in some sort of check to see if the page is published properly before it goes continues to redirect?

    Below is the code I am using, you will notice that I already have some checks in to make sure the page gets published properly and the cache refreshed before continuing because I did have issues before with this not working correctly:

    // publish application node
    bool success = false;
    for (int i = 0; i < 3; i++)
    {
        if (success)
            break;
    
        // try 3 times to publish
        try
        {
            t.Publish(u);
            success = true;
        }
        catch
        {
    
        }
    }                            
    
    // update the document cache so its available in the XML
    success = false;
    for (int i = 0; i < 3; i++)
    {
        if (success)
            break;
    
        // try 3 times to update the cache
        try
        {
            library.UpdateDocumentCache(t.Id);
            success = true;
        }
        catch
        {
    
        }
    }
    
    // Refresh cache
    library.RefreshContent();
    
    // Finally redirect and add message
    page = string.Concat(library.NiceUrl(t.Id), "?");
    usermessage = library.GetDictionaryItem("TopicCreated");
    //returnurl = string.Concat(page, "nf=true&amp;m=", usermessage.UrlEncode());
    returnurl = string.Concat(page, "nf=true");
    return returnurl;

     

  • trfletch 595 posts 571 karma points
    Oct 16, 2012 @ 15:28
    trfletch
    0

    Can no-one offer any advice on this? Even if you can't explain why it would be happening but you know a way that I could check the node is fully created and accessible before trying to redirect to it so that the user does not get an error?

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Oct 19, 2012 @ 18:10
    Tom Fulton
    0

    Hi,

    Unfortunately I'm not sure why this is happening.  My guess is its something to do with the "AutoFolders" that get created with your document, maybe its taking some extra time to create those and I don't think your doc will be viewable until those are published as well.

    Theoretically you could check to see if it's published by trying to access the node id with NodeFactory.  But since you're using NiceUrl I would assume the node is technically considered "published".

    Sorry I can't offer more insight :/

    -Tom

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies