Previously, I used HttpModule to change the Cookie before Response. Today, ASP. NET Self-made ideas, converting the representation of the hard-to-use conversion of Chinese characters into Chinese characters, not ASP. NET Web control, 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 ASP. NET is generated, 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)
- {
- StringWriterSw=NewStringWriter ();
- HtmlTextWriterHtmlw=NewHtmlTextWriter (sw );
- // Extract the page generated content
- Base. Render (htmlw );
- Htmlw. Flush ();
- Htmlw. Close ();
- StringPageContent=Sw. ToString ();
- // Modify the content
- PageContent=KillTheBugAndShit(PageContent );
- Response. Write (pageContent );
- // Base. Render (writer );
- }
By using the Render method, you can also take out the content generated by the page to generate a static page.
- DataList and Repeater controls of ASP. NET
- Analysis of IIS ing in ASP. NET
- Overview ASP. NET status types
- Introduction to ASP. NET and Web servers
- EnableViewState attribute of ASP. NET