Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
SavePage("http://localhost/tstProj/scrapage.aspx", "c:\scrapage.html")
End Sub
Private Sub SavePage(ByVal Url As String, ByVal FilePath As String)
Dim iMessage As CDO.Message = New CDO.Message
iMessage.CreateMHTMLBody(Url, _
CDO.CdoMHTMLFlags.cdoSuppressNone, "", "")
Dim adodbstream As ADODB.Stream = New ADODB.Stream
adodbstream.Type = ADODB.StreamTypeEnum.adTypeText
adodbstream.Charset = "US-ASCII"
adodbstream.Open()
iMessage.DataSource.SaveToObject(adodbstream, "_Stream")
adodbstream.SaveToFile(FilePath, _
ADODB.SaveOptionsEnum.adSaveCreateOverWrite)
End Sub
End Class
For the above to compile you will need to add a reference to CDO, which is usually found sneaking deep in your C:\WINNT\System32 as C:\WINNT\System32\cdosys.dll
www.visli.com hot cake deals
No comments:
Post a Comment