Try our conversational search powered by Generative AI!

Issue with Url property

Vote:
 
If we use Opti's Url property, this gives us an option to select ,either page, media, external URL etc. If you select a CMS page here, you get the property value as link/guid.aspx (Link URL basically) but if you select External Link it gives you back whatever URL string was entered. However if you choose external Link and enter URL which is same as one of the subsites in your CMS , Opti doesn't give you back the actual URL string but instead converts and sends you a Link URL. 
Not sure if this is a bug or expected behavior in CMS 12.
#299843
Apr 10, 2023 19:33
Vote:
 

Standard behaviour I believe. Are you looking to render the friendly url? Wrap your Url property with a @Url.ContentUrl(Model.UrlPropertyHere)

#299962
Apr 11, 2023 23:54
Vote:
 

This is part of my search result where am expecting it to return regular url string so i can open it in a new window on click. This is how it was in CMS 11. Also  Itried to go through the documentation but don't see any place where it mentions about this being new or standard behavior.

#299964
Edited, Apr 12, 2023 0:57
Vote:
 

Hello DD,

I think this behaviour has been around for a while.  On the server side you should be able to use GetUrl method of the UrlResolver instance to achieve the same effect.  Also the EPiServer.Forms package includes a helper method of GetUrlString() which may solve your problem in this case too.

We've also used this with LinkItem from the LinkItemCollection which can have the same issue:

public static string GetFriendlyUrl(this LinkItem linkItem)
{
    return UrlResolver.Current.GetUrl(new UrlBuilder(linkItem.Href), ContextMode.Default) ?? string.Empty;
}
#300241
Edited, Apr 17, 2023 8:06
Vote:
 

Thanks for the update Mark. I am not sure if I had similar issue in CMS 11. I already resolved the issue by changing code to use UrlResolver but wanted to check out in forums about it.

#300484
Apr 21, 2023 1:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.