I am creating a page url from a Sitecore item using the following code:

var pageUrl = LinkManager.GetItemUrl(item);

The Sitecore item starts with a capital letter, e.g. Page.

At one machine LinkManager.GetItemUrl resolves to: http://<domain>/Page while on another machine (same item and code) resolves to: http://<domain>/page.

How is this possible? Is there a LinkManager configuration that I am overseeing?


On linkManager definition you have a setting lowercaseUrls:

<linkManager defaultProvider="sitecore">
      <clear />
      <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="false" />

I guess you override that setting.

On GetItemUrl is used that setting. If LowercaseUrls is false the link is not modified:

public virtual string GetItemUrl(Item item, UrlOptions options)
    Assert.ArgumentNotNull(item, "item");
    Assert.ArgumentNotNull(options, "options");
    LinkProvider.LinkBuilder linkBuilder = this.CreateLinkBuilder(options);
    string text = linkBuilder.GetItemUrl(item);
    if (options.LowercaseUrls)
        text = text.ToLowerInvariant();
    return text;
| improve this answer | |
  • That solves it. In my case the preconfigured value was changed by the SXA installer: <linkManager patch:source="Sitecore.Commerce.XA.Foundation.Catalog.config" defaultProvider="commerce">. – Joost Feb 27 '19 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.