简体   繁体   中英

How to save the second web page in browser using vb.net

I am opening a new tab in the browser and i want to save the page in html format.

My code is :

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)

Here am opening a new window.Now i want to save the new web page in the html format. Please help me how to save the web page in new opened tab.

If you want to capture the response from a given URL server-side and save it to a file on the server, you can do something like this, using the WebRequest class:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM