急!!!!在vb.net中webfrom中点一个button按钮,将本页的后台的html代码中的body之间代码,原样输出到一个自己刚用代码建立的txt文本中.
TR!!!!最好有例子...谢谢
[解决办法]
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Dim sw As New StringWriter()
Dim op As New HtmlTextWriter(sw)
MyBase.Render(op)
'html代码
Dim strHtml As String = sw.GetStringBuilder().ToString()
'获取body之间的字符串
Dim strhtml1 As String = strHtml.Substring(strHtml.IndexOf( " <body> ") + 6, strHtml.IndexOf( " </body> ") - strHtml.IndexOf( " <body> ") - 6)
'把HTML文件写到磁盘
Dim sw1 As New System.IO.StreamWriter(Server.MapPath( "a.htm "), False, System.Text.Encoding.Default)
sw1.Write(strhtml1)
sw1.Close()
Response.Write(strHtml)
End Sub