November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hey Adam,
Could you inform us on what you are using for a framework. MVC, Webforms?
You can use the url resolver if you need too. UrlResolver.Current.GetUrl(contentLink) or mvc @Url.ContentUrl(contnetlink or url).
Thanks Adam,
Can you post a code sample that is not being re-written. I supect that either the routescollection is not being registered or operator error. Could do you use the favor of posting a sample code that is not working as you intend it too.
Hi Joshua, sure.
Using an episerver url field:
public virtual Url TargetUrl { get; set; }
markup
<a href="@Model.TargetUrl" class="button button--black">Read more</a>
output
http://london.barratt.local/link/ca0fb5a5d257415383fba09c4dde432f.aspx?id=96
Using an episerver typed page field:
public T CurrentPage { get; private set; } (T being the typed page data).
markup
<a href="@(((PageData)Model.CurrentPage).LinkURL)" class="news-articles__cta">Read more</a>
output
http://london.barratt.local/link/47dca4f6a5e84447b23f4591278cf458.aspx?id=14&epslanguage=en
In the mean time ive been using the UrlResolver.Current.GetUrl(contentLink) or mvc @Url.ContentUrl(contnetlink or url) you suggested above, which works on both.
do this
<a href="@Url.CotnentUrl(Model.TargetUrl)" class="button button--black">Read More</a> and for the second one. Do <a href="@Url.ContentUrl(Model.CurrentPage.ContentLink> class="news-articles__cta">Read More</a>
let me know if that works for you.
hi Josh, as i said at the bottom, I am already doing that as per your original post and it works fine (thanks!).
I was jsut expecting those links to be re-written automatically, like they would in web forms, but i guess this is handled differently for mvc razor?
So webforms does work differently as they use a url rewrite provider and in mvc, they use mvc's routing so it is two different technologies. Sorry for the misunderstanding of your post. I guess i didnt see that portion. But in mvc, this is how you have to do it. Sorry for the confusion.
hi guys, currently, internal page links coming from objects such as url or content links are not being rewritten to friendly urls by episerver on page render. What things do I need to check are set for this to occur please?