When you do this, the configured URLRewriteProvider doesn't seem to kick in like you're used to. Links to EPiServer-pages are output simply as /Path/To/Your/Template.aspx?id=1337. It works, but exposing your application's inner workings to the browser isnt' really clean.

The solution, however, is simpler than I first thought. At least in my case, when rendering an .ascx from a handler. Simply add the following line somewhere before Request.End() is called, and your links will be as /pretty/as/they/should/be/:

UrlRewriteProvider.Module.HtmlAddRewriteToExternalFilter(HttpContext.Current.ApplicationInstance);

It's all in the details.

Update: This uses default EPiServer rewrite functionality. In my case, I also needed to hide a link in an input type="hidden", which was not rewritten. So it seems that ConvertToExternal-like methods still have a purpose.