Problem:
Delivery of a customer's website some time ago. The customer proposed to speed up the webpage when loading FLASH, and requested some improvement.
I wrote the Flash content as a control and added some attributes that Flash needs to use to generate scripts and insert them to the page. It turns out to be directly executed in the page insertion position.
Rewrite the original control as required by the customer. Only one HTML Tag is generated for the original script execution location, and the corresponding script is added to the footer for insertion.
This requires operations on the results generated on the original aspx page.
Answer:
Create your own Page class, inherit from the original System. Web. UI. Page, and generate related writing methods. The specific code is as follows:
Copy to ClipboardReference: [www.bkjia.com] Public Class MyPageClass MyPage
Inherits System. Web. UI. Page
Dim sw As New System. IO. StringWriter
Dim _ writer As System. IO. TextWriter
Protected Overrides Function CreateHtmlTextWriter () Function CreateHtmlTextWriter (ByVal tw As System. IO. TextWriter) As System. Web. UI. HtmlTextWriter
_ Writer = MyBase. CreateHtmlTextWriter (tw)
Return MyBase. CreateHtmlTextWriter (sw)
End Function
Protected Overrides Sub Render () Sub Render (ByVal writer As System. Web. UI. HtmlTextWriter)
MyBase. Render (writer)
_ Writer. Write (Replace (sw. ToString, "</body>", "Custom content </body>", 1,-1, CompareMethod. Text ))
End Sub
End Class