Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arun 136 posts 369 karma points
    Dec 31, 2019 @ 05:20
    Arun
    0

    Error when http or https is not given with URL in URL Picker

    Hi Guys..

    I'm accessing a link from URL Picker using the code below

    --> var relatedLink = item.Value<Link>("relatedLink");

    and I'm using an anchor tag to go to that URL

    --> <a href="@relatedLink.Url" >

    but when i gave a URL as "www.google.com" the URL is loaded along with current page for eg : http://www.mysite.com/www.google.com

    I see the issue does not exist when URL begins with http or https

    Hence right now i have to check whether the URL begins with https and if not, adding it before URL. But i know its not an optimal solution How can i solve this...?

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Dec 31, 2019 @ 15:34
    Nik
    0

    Hi Arun,

    That is the only solution unless you write an extension method for the Link class to wrap the check up in reusable code. Because the URL picker allows people to write their own URLs in it's tricky to handle.

    You could put a custom validation event in the back office to pick up the check before it gets to front end rendering.

    Nik

  • Arun 136 posts 369 karma points
    Jan 08, 2020 @ 03:49
    Arun
    0

    Thanks Nik.. :)

    Right now i have given a message to the user to input the full URL

Please Sign in or register to post replies

Write your reply to:

Draft