Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I am using
var path = umbraco.library.NiceUrlWithDomain(Convert.ToInt32(nodeId));
To get full path of a particular node. My question is that How can i handle the situation in which nodeid is incorrect ?
Or is there any way to get full url by nodeid. please help me on this .
Manish
You are using the old, deprecated API. With the new API you have a couple of choices:
var path = Umbraco.Url(nodeId, UrlProviderMode.Absolute);
(You'll need to add a reference to Umbraco.Web.Routing).
Umbraco.Web.Routing
If the nodeId doesn't exist then path will equal "#" so you can check for that.
nodeId
Or you could use:
var node = Umbraco.TypedContent(nodeId); if (node != null) { string path = node.UrlAbsolute(); }
Thanks Dan
Umbraco 8 :
var content = Umbraco.Content(Id); var url=content.Url(string culture = null, UrlMode mode = UrlMode.Auto);
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.
Continue discussion
Getting full url by node id
Hi
I am using
To get full path of a particular node. My question is that How can i handle the situation in which nodeid is incorrect ?
Or is there any way to get full url by nodeid. please help me on this .
Manish
You are using the old, deprecated API. With the new API you have a couple of choices:
(You'll need to add a reference to
Umbraco.Web.Routing
).If the
nodeId
doesn't exist then path will equal "#" so you can check for that.Or you could use:
Thanks Dan
Umbraco 8 :
var content = Umbraco.Content(Id); var url=content.Url(string culture = null, UrlMode mode = UrlMode.Auto);
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.