Whats the difference between .Url property and Umbraco.Url(1234)

« Back to list of posts

When it comes down to it, the .Url property of an IPublishedContent object type, has already been loaded into memory, accessing it will be very quick, providing you've already loaded the node into memory for other purposes, where as the Umbraco.Url(nodeid) method will get the value for any defined node id.

When to use

Use the .Url property if you already have a node loaded into memory for other purposes, such as reading properties from it.

Use Umbraco.Url(nodeid) when you're just linking to a node and don't need any other properties from it.

So whats NiceUrl?

The NiceUrl property and associated Umbraco helper method are legacy and should not be used. Whilst they do work and haven't been marked obsolete, they may be removed in future versions of Umbraco.


By Luke Alderton at 1 Sep 2016, 08:51 AM

Tags: Umbraco

Comments


Post a comment

Please correct the following:
Share with