{
//used to save the rendered HTML text
The StringBuilder sb;
//this a few Writer according to write the
StringWriter sw;
HtmlTextWriter hw.
TextWriter tw.
///& lt; Summary>
///load the "view" former executive
///& lt;/summary>
///& lt; Param name="filterContext & gt;"
Public override void OnResultExecuting (ResultExecutingContext filterContext)
{
//save the HTML
Sb=new StringBuilder ();
//two writer
Sw=new StringWriter (sb);
Hw=new HtmlTextWriter (sw);
//remember the Response output stream, originally used to return to the request of HTML, used with next
//at the end of the render, to write HTML content in tw
Tw=filterContext. RequestContext. HttpContext. Response. The Output;
//filter output stream, used to get the rendered HTML content
FilterContext. RequestContext. HttpContext. Response. The Output=hw;
}
///& lt; Summary>
///load the "view" executed after
///& lt;/summary>
///& lt; Param name="filterContext & gt;"
Public override void OnResultExecuted (ResultExecutedContext filterContext)
{
A string of HTML=sb. ToString ();
//to secondary treatment in Output new HTML page write filterContext. RequestContext. HttpContext. Response. The Output
Tw. Write (HTML);
}
}
Question: if the refresh the page many times, can lead to additional content display HTML content, or the page content can't display, display blank, excuse me, how to deal with concurrency, normal output page
CodePudding user response:
Question: if the refresh the page many times, can lead to additional content display HTML content, or the page content can't display, display blank, excuse me, how to deal with concurrency, normal output pageCodePudding user response:
what a great spirit all have no??????????????????????????????CodePudding user response:
Access to the page content in OnActionExecuted modified output