I'm using custom Render method for ContentPlaceholders on MasterPage to render html as json safe string. What I noticed is all urls are not parsed by Friendly URLs and are looking like "/Templates/Pages/Hub.aspx?id=13".
here is piece of code:
protected void RenderJsonSafeContentPlaceHolder(HtmlTextWriter writer, Control Container)
// setup a TextWriter to capture the markup
TextWriter tw = new StringWriter();
var htw = new XhtmlTextWriter(tw, HtmlTextWriter.DefaultTabString);
foreach (Control ctrl in Container.Controls)
// render the markup into our surrogate TextWriter
var pageSource = [some replacing here]
I also tried Emil's solution from http://www.meadow.se/wordpress/retreive-html-code-for-a-web-user-control/, but problem occurs even if I run it Page_Unload.
Any ideas how to make my urls pretty?
Looks like UrlRewriteModule is skipping html which is previously parsed with HttpUtility.HtmlEncode (it's part of [some replacing here]). Probably because it's not a valid html anymore. Anybody knows how to force UrlRewriteModule to parse encoded html?
The HTML rewriting is only done on responses of type 'text/html'. And in CMS7.5 HTML rewriting is only done on pages inheriting TemplatePage.
Depending on which version you are running you could call manually call UrlResolver.GetUrl/GetVirtualPath or Global.UrlRewriteProvider.ConvertToExternal