Solved

>NET Download Data

Posted on 2004-08-17
3
236 Views
Last Modified: 2010-05-18
I would kike to be able to download web pages or web daa such as

http://www.site.com/downlaod.php?id=3
or

http://www.site.com/pagte.htm
to a variable in my windoww form

 is there a way to do this using the HTTP Request or any other class in the .NET framework.

I am working in VB.net

Thanks
0
Comment
Question by:vazzyb
3 Comments
 

Accepted Solution

by:
Laytons earned 125 total points
Comment Utility
If you want to get you hands on the underlying HTML contained within the web page you could try something like this. You will need a reference to Microsoft.mshtml first.

Imports System.Net
Imports mshtml

            Dim objResponse As HttpWebResponse
            Dim strTarget As String = "http://www.site.com/pagte.htm"
            Dim objRequest As HttpWebRequest = HttpWebRequest.Create(strTarget)
            Dim objStream As Stream
            Dim objGetStream As StreamReader
            Dim encode As System.Text.Encoding = System.Text.Encoding.GetEncoding("utf-8")

            objResponse = objRequest.GetResponse()
            objStream = objResponse.GetResponseStream
            objGetStream = New StreamReader(objStream, encode)
            Dim read(256) As Char

            Dim count As Integer = objGetStream.Read(read, 0, 256)
            While count > 0
                Dim str As New String(read, 0, count)
                strSource &= str
                count = objGetStream.Read(read, 0, 256)
            End While

            objGetStream.Close()
            objResponse.Close()
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
 shows up in Outlook, not OWA or on phone 3 57
Excel object stays open 19 64
strCopies  challenge 17 73
strDist challenge 35 84
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now