using the umbracoUrlAlias, the node.id = -1, so it's not finding the correct node on the call.
So is there a way to get the node from the umbracoUrlAlias? I need to check a property on the page before it is served so I can redirect or not for certain pages for mobile devices.
Stephan - in the original post - This is umbraco v 4.0.4.2. Not sure what version of uComponents.
Charlie - I am not sure what you are asking? Each page has individual settings, so I need figure out what the settings for the page they are asking for are.
ah ok, its becuase i think i was told that uQuery.GetNodeByUrl(request.RawUrl); is not encrypted, thus it is not tamper proof if it is a public faceing website.
get node by umbracoUrlAlias ul
I am using the uComponents method to get a node from the URL:
and then get some properties of the page
However that is not working if the requested url (from request.RawUrl) is the umbracoUrlAlias
Example:
- the full page is http://localhost/landing-pages/touchpoint-1--woohoo!.aspx
- the umbracoUrlAlias has the page at http://localhost/woo-hoo
using the umbracoUrlAlias, the node.id = -1, so it's not finding the correct node on the call.
So is there a way to get the node from the umbracoUrlAlias? I need to check a property on the page before it is served so I can redirect or not for certain pages for mobile devices.
This is umbraco v 4.0.4.2
Some more thoughts - this is using the older umbraco xml synatx with <node><data> etc.
So I tested this in an xsl to find the ID of the node I want and it works.
Now I am trying to translate that into using uQuery.GetNodesByXPath but I can't figure out the correct syntax, it keeps coming up with 0 nodes
I've tried this various things:
any ideas on what that syntax should be?
ok, finally found a solution.
This worked:
so to translate, you have to remove the / from the beginning of RawUrl
and then check if nodes.Count > 0 and get nodes[0]
Hi, why are you using uQuery to get the Node by Url? Charlie :)
Charlie - how else would I do it? When I google ' how to get umbraco node by url ' that is the only solution I could find.
If you know of a better solution - please share!
What version of Umbraco is that?
In _theory_ starting with 4.11 it should work 'out of the box' including supporting umbracoUrlAlias.
Stephan
Hi, Karen was just wondering why you were choosing the url or the id for instance? Charlie :)
Stephan - in the original post - This is umbraco v 4.0.4.2. Not sure what version of uComponents.
Charlie - I am not sure what you are asking? Each page has individual settings, so I need figure out what the settings for the page they are asking for are.
ah ok, its becuase i think i was told that uQuery.GetNodeByUrl(request.RawUrl); is not encrypted, thus it is not tamper proof if it is a public faceing website.
is working on a reply...