Solved

>NET Download Data

Posted on 2004-08-17
3
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
draw a Christmas tree by using a nested loop? 26 106
Back-end Database connect string being set someplace where I can't find it. 10 68
Java List 4 76
MCAT Verbal Reasoning 2 22
A short article about a problem I had getting the GPS LocationListener working.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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 …
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 …

710 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