You are most certainly using @Html.Raw(Model.MainBody), instead you should use @Html.PropertyFor(x => Model.MainBody)
cheers!
Neary true Marcus, I have a helperfunction
@helper NavigationItemTemplate(string header, XhtmlString content) {
<div>
@if (header != null && content != null)
{
<h3>@header</h3>
@content
}
</div>
}
And when writing @content it does this.
Using ProprtyFor fix this
There is another solution to this problem that we find and I write it here so others can use it.
There are places where you can't/don't want to use PropertyFor, for example in the footer of the page or in a more advanced menu. In that case you can use @Html.XhtmlString(content) (Where content is XHTML-string) instead of just @content and that will make EPiServer to write out friendly url instead of unFriendly.
Thanks to Magnus Forsberg at Active Solution who showed me that
We have some xhtml-property where users add links to other pages on the same site with the built in tiny-MCE editor. The problem we have is that EPiServer is writing out the unfriendly version of the url to the page (for example; http://wwwtest.company.se/link/1789998ab7954e2e9ad8f6120b348982.aspx?id=16054&epslanguage=sv).
This takes the visitor to first a 301-page and then to the friendly version of the url but with id and language parameters.
Are there any way to get the xhtml-property to write out the friendly version of url?