November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Have you tried:
string linkUrl = string.Empty; PermanentLinkMapStore.TryToMapped(CurrentBlock.FeatureImage.Uri.ToString(), out linkUrl);
If you had used MVC you could have used @Url.ContentUrl(Model.CurrentPage.FeatureImage) but I do not know it that is possible in webform.
What you can do is to wrap that in a function that use this code:
var urlHelper = ServiceLocator.Current.GetInstance<UrlHelper>(); var friendlyUrl = urlHelper.ContentUrl([PASSED LINK TO FUNCTION]);
It is more explained here:
http://world.episerver.com/Forum/Developer-forum/-EPiServer-75-CMS/Thread-Container/2014/4/Get-friendly-Url-from-Url-property/
PermanentLinkMapStore.TryToMapped(CurrentBlock.FeatureImage.Uri.ToString(), out linkUrl); returns something like /link/e5d12600-ec7d-4592-a124-f08a525caa94.aspx?id=1111&epslanguage=en
There is no method ContentUrl on UrlHelper class.Also, None of other methods mentioned in other thread worked :(.
All i am doing is on model
[UIHint(UIHint.Image)] public virtual Url UrlToImage{get;set;}
and in the aspx page
<%=this.CurrentPage.UrlToImage %>
but it shows something like /link/e5d12600-ec7d-4592-a124-f08a525caa94.aspx?id=1111&epslanguage=en
Property control renders it correctly by showing something /global/a.jpg.
but i dont want (can't) use property control.
Any other suggestions guys?
The following code sample should give you friendly url. (there is no error checking in this code)
var urlHelper = ServiceLocator.Current.GetInstance<UrlResolver>(); var friendlyUrlBuilder = new UrlBuilder(this.CurrentPage.NewLogoUrl.ToString()); ContentReference contentReference = PermanentLinkUtility.GetContentReference(friendlyUrlBuilder); string url = urlHelper.GetUrl(contentReference); return url;
I am unsure if this is the best way of doing it but it seems to be working fine.
Hi guys,
Consider you have the following image property
Now Writing the follwing in webforms returns the non friendly url
How can I get the friendly url of this image? (Note, i don't want to use EPiServer:Property control as using that will return friendly url but i can't to use that)
Thanks