volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

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.

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

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