Copied to clipboard

Flag this post as spam?

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


  • g3t 32 posts 144 karma points
    Dec 05, 2016 @ 13:51
    g3t
    0

    relative url

    Hi

    Is there something i can use inplace of @item.Url to generate a relative url and then prefix this with hardcoded domain.

    so something like

    <a  href="fixed-domain.com + @item.Url" >@item.Name</a>
    

    thanks

  • John Lee 6 posts 116 karma points
    Dec 05, 2016 @ 14:02
    John Lee
    1

    Just create a Uri, and get its PathAndQuery:

    <a  href="fixed-domain.com + @(new Uri(item.Url).PathAndQuery)" >@item.Name</a>
    
  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    Dec 06, 2016 @ 10:46
    Paul Seal
    1

    If item is an IPublishedContent then you can use:

    @item.UrlWithDomain()
    
Please Sign in or register to post replies

Write your reply to:

Draft