Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How save a In-mory ASP.NET page to disk???
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00769883
Message ID:
00770651
Views:
23
Rick,

Here is how to get the HTML generated before it is sent to the client:
protected override void Render (HtmlTextWriter writer) 
{
	StringBuilder stringBuilder = new StringBuilder();
	StringWriter stringWriter = new StringWriter(stringBuilder);
	HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
	base.Render(htmlWriter);
	string yourHtml = stringBuilder.ToString(); 
	// yourHtml string contains the HTML generated
}
>ACtually I need to something like this as well - I need to actually use content generated from an ASP page in an email confirmation and I want to capture the output generated before it gets sent back to the client.
>
>I suspect there are events on teh HTTPRuntime to do this but I haven't gotten this far yet...
>
>+++ Rick ---
>
>
>>Mario,
>>
>>How about caching the page? It would be faster than writing to disk. Here is an article that explains how to setup your page to use caching:
>>
>>http://www.sitepoint.com/article/1007
>>
>>
>>>I build a complete ASP.NET page in run-time. That it, i add the controls, validators, and do a manual bind of the data. I need that because the layaout and controls can change, but that not happend so much.
>>>
>>>This meaning that the system rebuild in each hit the whole page. So i like to store the page in disk the first time and get them from here, and rebuild only when the layout&control change, and only set the data from my database.
>>>
>>>How i can do that????
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform