N NRD Jun 29, 2004 #1 i'm looking for an example using vb.net to connect to a webserver,request a webpage and get the returned html page. tq.
i'm looking for an example using vb.net to connect to a webserver,request a webpage and get the returned html page. tq.
G Guest Jun 29, 2004 #2 Have a look at HttpWebRequest. Here is a short example: Dim req As HttpWebRequest = WebRequest.Create ("http://www.microsoft.com") Dim resp As HttpWebResponse = req.GetResponse() Dim receiveStream As Stream = resp.GetResponseStream() Dim reader As StreamReader = New StreamReader(receiveStream, System.Text.Encoding.UTF8) Dim content As String = reader.ReadToEnd() Console.Write(content) reader.Close() Regards, Jakob.
Have a look at HttpWebRequest. Here is a short example: Dim req As HttpWebRequest = WebRequest.Create ("http://www.microsoft.com") Dim resp As HttpWebResponse = req.GetResponse() Dim receiveStream As Stream = resp.GetResponseStream() Dim reader As StreamReader = New StreamReader(receiveStream, System.Text.Encoding.UTF8) Dim content As String = reader.ReadToEnd() Console.Write(content) reader.Close() Regards, Jakob.
N NRD Jun 29, 2004 #3 at first i got problem - importing System.Web, instead of System.Net (got confused with HTTPWebRequest and HTTPRequest). Anyway,it works.. thanks....
at first i got problem - importing System.Web, instead of System.Net (got confused with HTTPWebRequest and HTTPRequest). Anyway,it works.. thanks....