Getting the URL of a Sitecore Item
You may expect a Sitecore Item to contain a property for its URL, however to actually get the URL of an item you need to use the LinkManager class.
There are also a few different options when getting an items URL, such as if you include the language code or not.
The following example gets the URL for an item with no language code and has a path relative to the site it is in. This is useful when your Sitecore instance may have multiple sites running and your home node isn't at the root of the content tree.
1Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions(); urlOptions.SiteResolving = true; urlOptions.LanguageEmbedding = Sitecore.Links.LanguageEmbedding.Never; string url = Sitecore.Links.LinkManager.GetItemUrl(item, urlOptions);