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
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 .
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).
If the nodeId doesn't exist then path will equal "#" so you can check for that.
Or you could use:
var node = Umbraco.TypedContent(nodeId);
if (node != null)
string path = node.UrlAbsolute();
Umbraco 8 :
var content = Umbraco.Content(Id);
var url=content.Url(string culture = null, UrlMode mode = UrlMode.Auto);
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted