Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to download to a complete web page with vb.net

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to download a complete web page with vb.net", the explanation content in the article is simple and clear, easy to learn and understand, please follow the ideas of Xiaobian slowly, together to study and learn "how to download a complete web page with vb.net"!

Found a lot of programs about web page download on the network, but can not get the complete content of the web page, the following function solves this problem.

Private Function GetSource(ByVal url As String) As String Try Dim httpReq As System.Net. HttpWebRequest 'The HttpWebRequest class provides support for properties and methods defined in WebRequest' and additional properties and methods that enable users to interact directly with servers using HTTP. Dim httpResp As System. Net.HttpWebResponse ' HttpWebResponse class is used to generate HTTP standalone client applications that send HTTP requests and receive HTTP responses. Dim httpURL As New System.Uri(url) httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest) httpReq.Method = "GET" httpResp = CType(httpReq.GetResponse(), HttpWebResponse) Dim reader As StreamReader = _ New StreamReader(httpResp.GetResponseStream, System.Text.Encoding.GetEncoding("GB2312")) 'If Chinese, set the encoding format to "GB2312." Dim respHTML As String = reader.ReadToEnd() 'respHTML is the web page source code Return respHTML httpResp.Close() Catch e As Exception Console.WriteLine("GetSource has a problem:{0},{1}," e.Message, url) End Try End Function Thank you for reading, the above is "how to use vb.net download to the complete web page" content, after the study of this article, I believe we have a deeper understanding of how to use vb.net download to the complete web page, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report