Try our conversational search powered by Generative AI!

Links with xhtmlstring ToHtmlString()

Vote:
 

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.

#140293
Oct 15, 2015 9:36
Vote:
 

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. :/

#140396
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.