Connecting to Internet from code

  • Thread starter Thread starter JustMe
  • Start date Start date
J

JustMe

Sorry - probably a stupid question, but I don't know the answer!

I have a windows service which needs to connect to (and also
disconnect from) the internet automatically without user intervention
from vb.net.

Can anyone help?
 
Hi Adrew

Something as this

\\\
Dim myReg As Net.HttpWebRequest = _
DirectCast(Net.WebRequest.Create("http://wathever/mypage.html"), _
Net.HttpWebRequest)
Dim myResp As Net.HttpWebResponse = _
DirectCast(myReg.GetResponse(), Net.HttpWebResponse)
Dim myStream As IO.Stream = myResp.GetResponseStream()
Dim myreader As New IO.StreamReader(myStream)
Dim mystring As String = myreader.ReadToEnd()
myResp.Close()
///

I hope this helps?

Cor
 

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

Back
Top