Szukaj…


Składnia

  • publiczny ciąg statyczny GetItemUrl (pozycja elementu)
  • publiczny ciąg statyczny GetItemUrl (pozycja elementu, opcje UrlOptions);

Uzyskiwanie adresu URL przedmiotu

Biorąc pod uwagę prosty element sitecore:

Item item;

Sam element nie zawiera swojego adresu URL. Aby uzyskać adres URL elementu, musisz wywołać klasę static Sitecore.Links.LinkManager

string url = LinkManager.GetItemUrl(item);

przeciążenie tego akceptuje klasę UrlOptions :

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


Modified text is an extract of the original Stack Overflow Documentation
Licencjonowany na podstawie CC BY-SA 3.0
Nie związany z Stack Overflow