I'm trying to render a link like the following as an external link - however it's cutting off part of the query parameter.

So when I try to render this:


The href attribute will show as this:


It basically slices at the point where a query string is specified in the query parameter.

Is this a known issue in 7.2 and is there a workaround without resorting to javacript? I've tried url encoding the question mark and the result is the same.


  • Have you tried with encoded question mark character? %3F? https://www.example.com?url=http://www.another-url.com/%3Fid=1
    – Marek Musielak
    Dec 6, 2019 at 12:49
  • @MarekMusielak Yes - same result unfortunately
    – Sean T
    Dec 6, 2019 at 12:50
  • What's your purpose perhaps we can find a workaround? Anyway is it a WebForms project? Dec 6, 2019 at 13:23
  • No it's MVC, I'm beginning to think it could be an issue with Glass library. It's an external link that uses adfs so it needs a redirect url appending to query string of the query string
    – Sean T
    Dec 6, 2019 at 13:37
  • Sean as it is MVC it can be a routing issue. I would consider this too - perhaps the question mark is interpreted as parameter indication Dec 6, 2019 at 13:55

1 Answer 1


The vanilla Sitecore code to render a General Link field containing this external Url would be:

LinkField lf = myitem.Fields["name of your field"];
string url = lf.GetFriendlyUrl();

You should verify this behaviour. It will either work as you expect, or it will be a bug in Sitecore. The string url should be exactly as given as value in the Sitecore client.

If it looks like you expect, your issue would be either in Glass - or on how you later pass that url on. E.g. returning it to a view but NOT inside a HtmlString or so.

  • Thanks, will give the a try tomorrow morning
    – Sean T
    Dec 9, 2019 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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