Create link to Sitecore Item

Posted by Zooking on Stack Overflow See other posts from Stack Overflow or by Zooking
Published on 2009-03-23T17:13:19Z Indexed on 2012/10/15 9:38 UTC
Read the original article Hit count: 175

Filed under:
|

I know I have done this before but I can't seem to remember where or how.

I want to create a link to an Item in Sitecore. This code:

Sitecore.Data.Items.Item itm = Sitecore.Context.Database.GetItem(someID);
return itm.Paths.Path.ToString();

Produces the following string:

http://localhost/sitecore/content/Home/Item1/Item11/thisItem

I would like to have this string instead:

http://localhost/Item1/Item11/thisItem.aspx

What is the correct way to get the path to the item? In this case I can't use a normal Sitecore link:

Sitecore.Web.UI.WebControls.Link

© Stack Overflow or respective owner

Related posts about sitecore

Related posts about sitecore6