RenderView() into a buffer.


RenderView() into a buffer.

Published on Sun 16 Dec 2007 12:12 ( 2 years, 2 months ago)
ASP.NET Learning notes

RenderView into a buffer and then we can do something on the result before output.

via: http://forums.asp.net/t/1193898.aspx

[ControllerAction]
public void About()
{
StringWriter interceptingWriter = new StringWriter();
TextWriter originalWriter = this.ControllerContext.HttpContext.Response.SwitchWriter(interceptingWriter);
RenderView("About");

originalWriter.Write("The text written was: " + interceptingWriter.ToString());
}
This is still raw, but we can have a customized controller class handle all those better. 
 


Related posts:


Search related in web:

Custom Search

RSS Feed

One click subscribe this blog in your google reader!

Be social!


Want to say something here? please sign in



Blog posts link to this page
What are friends tweeting?
Tags cloud
Monthly Archives