[英]How to save the second web page in browser using vb.net
我正在瀏覽器中打開一個新標簽,我想將頁面保存為html格式。
我的代碼是:
Page.ClientScript.RegisterStartupScript(Me.[GetType](), "OpenWindow", "window.open('https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=stack+overflow','_newtab');", True)
在這里打開一個新窗口。現在我想將新網頁保存為html格式。 請幫助我如何將網頁保存在新打開的標簽頁中。
如果要從給定的URL服務器端捕獲響應並將其保存到服務器上的文件中,則可以使用WebRequest類執行以下操作:
Dim request As WebRequest = WebRequest.Create("http://www.example.com")
Using response As WebResponse = request.GetResponse()
Using reader As New StreamReader(response.GetResponseStream())
Dim html As String = reader.ReadToEnd()
File.WriteAllText("test.html", html)
End Using
End Using
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.