vb.net windows application that connects to the net.

C

Cerebrus99

I don't know if this code is very efficient, but here's a solution that has
worked for me...
---------------------------------------------------------------------
Dim PageAddress As String = "http://www.mysite.com

'Send a request to the site.
Dim myRequest As HttpWebRequest = CType(WebRequest.Create(PageAddress),
HttpWebRequest)

'Get a response from the site.
Dim myResponse As HttpWebResponse = CType(myRequest.GetResponse(),
HttpWebResponse)

'Get the data in stream format
Dim PageStream As Stream = myResponse.GetResponseStream()
Dim srPage As New StreamReader(PageStream, Encoding.UTF8)

'Read the contents using a buffer, or all at once, your preference.
Dim Contents As String = srPage.ReadToEnd()

'Extract information from the contents
MyMethod(Contents)

'Clean up
myResponse.Close()
srPage.Close()

---------------------------------------------------------------------

As far as logging into Yahoo! and Gmail accounts is concerned, that would
require authentication with a username and password. And I'm not sure how to
implement that. (If it is possible, since their servers would check for the
client)

Regards,

Cerebrus.
 
L

labrynth

Hello,

I am completely new to the windows platform and the .net technologies.
I have to pick up vb.net on a real fast track to develop industry code.
For my own learning purposes, I am writing a small application -

A typical windows application in vb.net which

contains a form with a button. When the button is clicked the
application -

1. must connect to a series of websites, and extract certain
information from the webpages and present it in textual format on the
form in the windows application.

2. must log in to my yahoo and gmail accounts, do nothing and log out.

Typically, I am not worried about the usre interface aspect of the
application but more about the 'Connectivity' techniques.

If someone could guide me in the right direction, it would help me get
onto a rapid start :)

Thanks,
Labrynth !
 
L

labrynth

Thanks! I lifted off the code u gave..it worked.. I did implement a
different version later on.. using the WebClient class, though the one
that you presented here seems to be a better way !
 

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