ASP.NET Pages are designed to stream their output directly to a response stream. This can be a huge performance benefit for large pages as it doesn?t require buffering and allocating very large strings before rendering. Allocating large strings can put them on the Large Object Heap which means they?ll be sticking around for a while. However, there are many cases in which you really want to render a page to a string so you can perform some post processing. I wrote about one means using a Response filter eons ago . However, recently, I learned about a method of the Page class I never noticed which allows me to use a much lighter weight approach to this problem. The method in question is CreateHtmlTextWriter which is protected, but also virtual...(read more) ...
Go to the complete details ...