当前位置:首页 >设计资讯> 正文

vb.net中当访问ASPX页面时生成静态页面

文章来源: 发布时间: 2017-12-24

Protected Overloads Overrides Sub Render(ByVal writer As HtmlTextWriter)
    Dim html As System.IO.StringWriter = New System.IO.StringWriter
    Dim tw As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(html)
    MyBase.Render(tw)
    Dim sw As System.IO.StreamWriter
    sw = New System.IO.StreamWriter(Server.MapPath("index.htm"), False, System.Text.Encoding.Default)
    sw.Write(html.ToString)
    sw.Close()
    tw.Close()
    Response.Write(html.ToString)
End sub