473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading a http page

Hi,

What is the shortest way to read contents of an http page into an string?

Thanks,
Alan
Nov 18 '05 #1
2 877
This may not be the correct response, your question is kind of vauge. Are
you talking about reading the html of a differnt page or the current page?

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim client As New System.Net.WebClient
Dim str As System.IO.Stream
str = client.OpenRead("http://www.amazon.com")
Dim reader As New System.IO.StreamReader(str)
Dim s As String = reader.ReadToEnd
Response.Write(s)
str.Close()
End Sub

note
"Ali.M" <Ha**@Spam.com> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
Hi,

What is the shortest way to read contents of an http page into an string?

Thanks,
Alan

Nov 18 '05 #2
Thanks, That is exactly what I was looking for!

"Jared" <VB***********@email.com> wrote in message
news:10*************@corp.supernews.com...
This may not be the correct response, your question is kind of vauge. Are
you talking about reading the html of a differnt page or the current page?

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim client As New System.Net.WebClient
Dim str As System.IO.Stream
str = client.OpenRead("http://www.amazon.com")
Dim reader As New System.IO.StreamReader(str)
Dim s As String = reader.ReadToEnd
Response.Write(s)
str.Close()
End Sub

note
"Ali.M" <Ha**@Spam.com> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
Hi,

What is the shortest way to read contents of an http page into an string?
Thanks,
Alan


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file "object" and name it f. # the second argument of open can be
7
by: jeff | last post by:
Hi. I am trying to read addresses from an Exchange 5.5 Global Address Book from an asp.net page. When the page executes the error "Collaboration Data Objects - ]" is generated. Here is the...
3
by: Darrel | last post by:
I've been working on a fairly simple CMS for a fairly small site. Each page is a DB query to grab the content for the page. I also have some ancillary content that isn't specifically associated...
5
by: darrel | last post by:
I have bits of content on a site that's running of a basic CMS system I've built. The main content on each page is pulled in from the DB, so there's at least one call to the DB on each page...
2
by: Thief_ | last post by:
I'm using the following code to read in a web page as HTML: ' Download the web page using the chosen update method. Dim sr As New...
7
by: Nuno Magalhaes | last post by:
I've got a problem which relates to reading HTTP data. I've got the socket connected to a web site and then I send "GET / HTTP/1.1\n\n" and the page is received after a while but not all of the...
9
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex...
1
by: David | last post by:
Hi, This one appears a little strange to me. Here is the scenario. I load a datalist the first time a page is run. The page has a !IsPostback and the datalist gets loaded at this point. I...
9
by: Milsnips | last post by:
Hi all. i'm tryng to implement the Rewrite.NET url rewritining functionality into a test project i've created, however i am hitting a problem at this line (direct from the web example): ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.