connect to web server using vb.net

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.
 
G

Guest

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

at first i got problem - importing System.Web, instead of System.Net (got
confused with HTTPWebRequest and HTTPRequest). Anyway,it works..
thanks....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top