connect to web server using vb.net

  • Thread starter Thread starter NRD
  • Start date Start date
N

NRD

i'm looking for an example using vb.net to connect to a webserver,request a
webpage and get the returned html page.

tq.
 
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.
 
at first i got problem - importing System.Web, instead of System.Net (got
confused with HTTPWebRequest and HTTPRequest). Anyway,it works..
thanks....
 
Back
Top