sitecore 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);