Try our conversational search powered by Generative AI!

GetHtmlRewriter

Vote:
 

I'm having a bit of trouble with an RSS flow on a page that I am developing. In the message text there is some links like this http://{sitename}.se/t/page.aspx?id=59 . When I have a string only containing the link there isn't any trouble to convert it with the following method:

UrlBuilder url = new UrlBuilder(page.LinkURL);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, page.PageLink, System.Text.UTF8Encoding.UTF8);


But now the links are inside an xhtlm string. I have seen some posts that recommend using GetHtmlRewriter. I can't figure how to use it; can someone post any tips or examples?

#19651
Apr 23, 2008 10:22
Vote:
 

This is the way I use to make the links to work in an external rss reader. 

UrlBuilder url = new UrlBuilder(page.LinkURL);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, page.PageLink, System.Text.UTF8Encoding.UTF8);


EPiServer.Global.UrlRewriteProvider.GetHtmlRewriter().RewriteString(new UrlBuilder(page.LinkURL), url, System.Text.UTF8Encoding.UTF8, your_string_here); 

I also do some Regex.Replace inserting SiteUrl before I use the code above.

#20466
Jun 02, 2008 9:21
* 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.