Solved

>NET Download Data

Posted on 2004-08-17
3
243 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
ID: 11818892
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
A short article about a problem I had getting the GPS LocationListener working.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

777 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