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
My Umbraco installation is as follows
SiteDefault - SiteTwo - SiteThree - Site Four
I have a web user control. How could I retrieve the root URL for each site please?
Thanks
When I enter this in my control I have a namespace error but I don't know which namespace I need to add. If this is the correct code does anyone know?
node.UrlAbsolute();
Hi Colin.
Is your 'node' an IPublishedContent item? In that case you can use the extensionmethod .Site() like this:
node.Site().Url;
For this you need the Umbraco.Web namespace referenced: https://our.umbraco.com/apidocs/v7/csharp/api/Umbraco.Web.PublishedContentExtensions.html
Hi Dennis
I'm trying this but I just can't get it to work on Umbraco 7.
Word you mind giving me a full example as no matter what I try it didn't work but it would be a published node under the home node.
OR even better without be to get the URL for the current page?
Many thanks
var root=Model.AncestorOrSelf(1)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to get root URL?
Hi
My Umbraco installation is as follows
I have a web user control. How could I retrieve the root URL for each site please?
Thanks
When I enter this in my control I have a namespace error but I don't know which namespace I need to add. If this is the correct code does anyone know?
node.UrlAbsolute();
Thanks
Hi Colin.
Is your 'node' an IPublishedContent item? In that case you can use the extensionmethod .Site() like this:
For this you need the Umbraco.Web namespace referenced: https://our.umbraco.com/apidocs/v7/csharp/api/Umbraco.Web.PublishedContentExtensions.html
Hi Dennis
I'm trying this but I just can't get it to work on Umbraco 7.
Word you mind giving me a full example as no matter what I try it didn't work but it would be a published node under the home node.
OR even better without be to get the URL for the current page?
Many thanks
is working on a reply...