I used to say that I used httpmodule to change the cookie before response. Today I met Asp.net's self-made claim to convert the representation of the hard-converted Chinese character into Chinese characters, not the Web Control of Asp.net, that is, the HTML control ranat = server will be forcibly converted into Chinese characters for output.
If you write a line of the page content in response, it is too tired and error-prone. So the best way is to perform another conversion after the Asp.net generation is complete, so Asp.net won't be able to take you.
All Asp.net generation actions are completed in the render method, so we will perform the operation on the render method:
Protected override void render (htmltextwriter writer)
{
Stringwriter Sw = new stringwriter ();
Htmltextwriter htmlw = new htmltextwriter (SW );
// Extract the page generated content
Base. Render (htmlw );
Htmlw. Flush ();
Htmlw. Close ();
String pagecontent = Sw. tostring ();
// Modify the content
Pagecontent = killthebugandshit (pagecontent );
Response. Write (pagecontent );
// Base. Render (writer );
}
In this way, you can also take out the content generated by the page to generate a static page.