LinkManager

Other topics

Obtaining a url for an Item

Given a simple sitecore item:

Item item;

The item itself does not contain it's url. To obtain a url for an item you need to make a call to the static class Sitecore.Links.LinkManager

string url = LinkManager.GetItemUrl(item);

an overload of this accepts a UrlOptions class:

UrlOptions options = new UrlOptions
{
     AddAspxExtension = false
     ....
};
string url = LinkManager.GetItemUrl(item, options);

Syntax:

  • public static string GetItemUrl(Item item)
  • public static string GetItemUrl(Item item, UrlOptions options);

Contributors

Topic Id: 7664

Example Ids: 25182

This site is not affiliated with any of the contributors.