Try our conversational search powered by Generative AI!

Links with xhtmlstring ToHtmlString()


I'm trying to use ToHtmlString(...) on an XHtmlString. When I do that, the links are not rewritten. I still get internal links, not external.

FYI: I'm using PrincipalInfo.AnonymousPrincipal, and I have some events hooked up to ContentRoute.CreatedVirtualPath.

Oct 15, 2015 9:36

The problem is that you need intercept and rewrite everything in xhtmlstring. I am guessing that you are trying todo somethig like @Model.MainBody directly into your view. That will work for most cases. But when you have links or you have for instance a block inside and XhtmlString property you will need to use the Html.PropertyFor. If you are not using that helper you will get the behavior you have at the moment sadly. :/

Oct 19, 2015 11:42
* 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.