XhtmlString: Render blocks and convert link to external without HtmlHelper

Here are two code snippets to help you make a XhtmlString display external links instead of the internal ones and also render blocks, dynamic content etc. This could be helpful if you don’t have access to a HtmlHelper like in a WebApi.

The first one just converts links. It loops through all fragments and converts internal UrlFragments to external.

Next snippet will also render blocks, dynamic content etc. It creates a “fake” HtmlHelper and then uses the same method as within EPiServer.


Leave a Reply

Your email address will not be published. Required fields are marked *