473,394 Members | 1,703 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,394 software developers and data experts.

Read data from a web page in VB.Net

Toooo tired to look this one up.

I have data that I need to acces in a small program. The
data is accessable from an ASP webpage that I created
myself. If I need to see data from record #25, I just
open http://mydomain.com/datapage.asp?recnum=25. I would
like to read this data directly into a variable. I'm sure
this is quite easy (as easy as Fileopen), but I just
can't seem to find it.

Thanks
John
Nov 20 '05 #1
5 18283
Cor
Hi Johnk
I have data that I need to acces in a small program. The
data is accessable from an ASP webpage that I created
myself. If I need to see data from record #25, I just
open http://mydomain.com/datapage.asp?recnum=25. I would
like to read this data directly into a variable. I'm sure
this is quite easy (as easy as Fileopen), but I just
can't seem to find it.


I won't know if it is difficult, but because of that you seems to use
classic ASP with a GET I think you do better asking this in a real ASP
newsgroup (not .NET)

I did for a while no classic ASP, therefore it would take me a lot of time
to help you, I don't know if there are others familiar with traditional ASP,
but I think from what I have seen from the regulars I think few, but I am
sure there are visitors who are still using it in this newsgroup, so maybe
you get your help here also, but take my advice and take a look in an real
ASP newsgroup.

Sorry I could not help you.

Cor
Nov 20 '05 #2
Maybe I wasn't too clear. I need to read some text from a webpage into my
vb.net program. I think that I may have found the solution though,
HttpWebRequest.

Thanks,
John
"Cor" <no*@non.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Johnk
I have data that I need to acces in a small program. The
data is accessable from an ASP webpage that I created
myself. If I need to see data from record #25, I just
open http://mydomain.com/datapage.asp?recnum=25. I would
like to read this data directly into a variable. I'm sure
this is quite easy (as easy as Fileopen), but I just
can't seem to find it.
I won't know if it is difficult, but because of that you seems to use
classic ASP with a GET I think you do better asking this in a real ASP
newsgroup (not .NET)

I did for a while no classic ASP, therefore it would take me a lot of time
to help you, I don't know if there are others familiar with traditional

ASP, but I think from what I have seen from the regulars I think few, but I am
sure there are visitors who are still using it in this newsgroup, so maybe
you get your help here also, but take my advice and take a look in an real
ASP newsgroup.

Sorry I could not help you.

Cor

Nov 20 '05 #3
Figured it out myself.

Imports System.IO

Imports System.Net

Imports System.Text

Public Class Form1

Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents txtPageSource As System.Windows.Forms.TextBox

Friend WithEvents txtURL As System.Windows.Forms.TextBox

Friend WithEvents Label1 As System.Windows.Forms.Label

Friend WithEvents btnGetSource As System.Windows.Forms.Button

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.txtPageSource = New System.Windows.Forms.TextBox()

Me.btnGetSource = New System.Windows.Forms.Button()

Me.txtURL = New System.Windows.Forms.TextBox()

Me.Label1 = New System.Windows.Forms.Label()

Me.SuspendLayout()

'

'txtPageSource

'

Me.txtPageSource.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or
System.Windows.Forms.AnchorStyles.Bottom) _

Or System.Windows.Forms.AnchorStyles.Left) _

Or System.Windows.Forms.AnchorStyles.Right)

Me.txtPageSource.Location = New System.Drawing.Point(8, 32)

Me.txtPageSource.Multiline = True

Me.txtPageSource.Name = "txtPageSource"

Me.txtPageSource.ScrollBars = System.Windows.Forms.ScrollBars.Both

Me.txtPageSource.Size = New System.Drawing.Size(672, 272)

Me.txtPageSource.TabIndex = 0

Me.txtPageSource.Text = ""

'

'btnGetSource

'

Me.btnGetSource.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or
System.Windows.Forms.AnchorStyles.Right)

Me.btnGetSource.Location = New System.Drawing.Point(552, 320)

Me.btnGetSource.Name = "btnGetSource"

Me.btnGetSource.Size = New System.Drawing.Size(112, 24)

Me.btnGetSource.TabIndex = 1

Me.btnGetSource.Text = "Get Source Code"

'

'txtURL

'

Me.txtURL.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or
System.Windows.Forms.AnchorStyles.Left) _

Or System.Windows.Forms.AnchorStyles.Right)

Me.txtURL.Location = New System.Drawing.Point(80, 8)

Me.txtURL.Name = "txtURL"

Me.txtURL.Size = New System.Drawing.Size(600, 20)

Me.txtURL.TabIndex = 2

Me.txtURL.Text = ""

'

'Label1

'

Me.Label1.Location = New System.Drawing.Point(8, 8)

Me.Label1.Name = "Label1"

Me.Label1.Size = New System.Drawing.Size(48, 23)

Me.Label1.TabIndex = 3

Me.Label1.Text = "URL"

Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(704, 366)

Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1,
Me.txtURL, Me.btnGetSource, Me.txtPageSource})

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

txtURL.Text = "http://www.jabtech.com"

End Sub

Private Sub btnGetSource_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGetSource.Click

Dim inputURL, WebPageSourceCode As String

Dim WebPage As HttpWebRequest

Dim WebPageText As WebResponse

Dim WebPageSource As Stream

Dim WebPageSourceText As StreamReader

On Error GoTo ErrorHandler

txtPageSource.Text = ""

inputURL = txtURL.Text

WebPage = WebRequest.Create(inputURL)

WebPageText = WebPage.GetResponse()

WebPageSource = WebPageText.GetResponseStream

WebPageSourceText = New StreamReader(WebPageSource,
System.Text.Encoding.ASCII)

WebPageSourceCode = WebPageSourceText.ReadToEnd()

WebPageSourceText.Close()

WebPageSource.Close()

txtPageSource.Text = WebPageSourceCode

Exit Sub

ErrorHandler:

MsgBox("Invalid URL or page not available")

Exit Sub

End Sub

End Class
"John Bradley" <br*****@jabtech.com> wrote in message
news:09****************************@phx.gbl...
Toooo tired to look this one up.

I have data that I need to acces in a small program. The
data is accessable from an ASP webpage that I created
myself. If I need to see data from record #25, I just
open http://mydomain.com/datapage.asp?recnum=25. I would
like to read this data directly into a variable. I'm sure
this is quite easy (as easy as Fileopen), but I just
can't seem to find it.

Thanks
John

Nov 20 '05 #4
"John Bradley" <hp@jabtech.org> schrieb
Figured it out myself.

[code]


Only a hint: To keep the identation and to avoid empty lines, you can paste
the code to notepad first, then from there into your posting. It makes it
easier for us to read (and use).
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
Cor
Greath John

Nov 20 '05 #6

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

Similar topics

2
by: nomenklatura | last post by:
Hi, I want to develop pocket pc program with visual studio .net this program read data from internet and bluetooth.. For example when i send data from program(server side) with bluetooth , other...
4
by: Mike Dole | last post by:
I'm working on a client - server application based on the 'How to Sockets Server and How to Sockets Client' code from the Visual Basic ..NET Resource Kit. Since I want to be able to send 'big...
2
by: Vanessa | last post by:
I need to read/extract data from an Excel file using ASP. However, the Excel file is not in regular tabular format; instead, it is actually a form. Therefore, it contains many checkbox and merged...
4
by: Mike | last post by:
I need to read a web a page and do a search on the page and gather information and put it into a text file. the web page is setup into a table, and displays information on files stuck in a queue....
12
by: Ron | last post by:
What is the VB equivalent of the READ...DATA statements in QuickBasic? Thanks
5
by: Arno | last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the inconvinience Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable...
4
by: Francois Stander | last post by:
Hi, hope someone can help me. It seems imposible to read data from a server, however, I can read the validation data from the server and hold it in dataviews . datasets or data tables in my asp...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
1
by: believeinblue44 | last post by:
I have recently spent countless hours building, tweaking, and perfecting numerous forms and they all are working fine now and i'm nearly done...now all i have to do is put them as Web Data Pages, put...
1
by: Mac951 | last post by:
I have been asked to automate a data entry task and I am not sure how to go about doing this, I have researced some forums post in BYTES and other as well but I am still not sure how to begin. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.