asp.net mvc 3 - Response.Clear() equivalent in MVC -


I am very new to MVC, I am a MVC3 aspx page from Response.Clear () How do I?

I have tried:

  Response.Clear (); ViewContext.HttpContext.Response.Clear ();  

Before any statement, none of them works in order to remain in the output in any HTML content. The only thing that seems to work for is response. Closed () , but of course I do not have permission to output anything later.

This is just a test / debugging exercise - I just want to be able to clear the buffer output, from the inline code in the ASPX page, and output what else anyone can do with web forms later is.

Note, I do not want to do this within the controller, because every time I make a change, as well as re-combinations to lose the session state. Every time ASPX is inside the page to avoid compiling it again. Your comment from

that you want to mess with your code before performing an action And afterwards, the most ideal solution is to use custom action filters:

  public interface IActionFilter {zero response filtering (action execution filter); Zero Onnection Integrated (Actioned Contact Filter Filter); }  

On-Action Acquiring is used to execute code before your controller action, while using the OnActionExecuted action method After the job is done.

Then you hook up a custom filter like this:

  public class MyCustomFilter: IActionFilter {public override zero operation (filter the proceeding contact listtext) {// your custom response Put and shaniness here ... return; }}  

You can then decorate your controller with this filter:

  [MyCustomFilter] Public Function List Some () {/ * Magic is here *  

You can accomplish a lot here, but I'm studying something else in it:


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -