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&m=", usermessage.UrlEncode());
returnurl = string.Concat(page, "nf=true");
return returnurl;
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?
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".
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:
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?
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
is working on a reply...
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.