Solved

>NET Download Data

Posted on 2004-08-17
3
240 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
powerN  challenge 3 57
object oriented javascript web form 8 104
Please explain: Aspect Oriented Programming 2 84
Not needed 13 94
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

911 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

21 Experts available now in Live!

Get 1:1 Help Now