473,804 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 18311
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******** ********@TK2MSF TNGP09.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.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()

Me.txtPageSourc e = 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.SuspendLayou t()

'

'txtPageSource

'

Me.txtPageSourc e.Anchor = (((System.Windo ws.Forms.Anchor Styles.Top Or
System.Windows. Forms.AnchorSty les.Bottom) _

Or System.Windows. Forms.AnchorSty les.Left) _

Or System.Windows. Forms.AnchorSty les.Right)

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

Me.txtPageSourc e.Multiline = True

Me.txtPageSourc e.Name = "txtPageSou rce"

Me.txtPageSourc e.ScrollBars = System.Windows. Forms.ScrollBar s.Both

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

Me.txtPageSourc e.TabIndex = 0

Me.txtPageSourc e.Text = ""

'

'btnGetSource

'

Me.btnGetSource .Anchor = (System.Windows .Forms.AnchorSt yles.Bottom Or
System.Windows. Forms.AnchorSty les.Right)

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

Me.btnGetSource .Name = "btnGetSour ce"

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

Me.btnGetSource .TabIndex = 1

Me.btnGetSource .Text = "Get Source Code"

'

'txtURL

'

Me.txtURL.Ancho r = ((System.Window s.Forms.AnchorS tyles.Top Or
System.Windows. Forms.AnchorSty les.Left) _

Or System.Windows. Forms.AnchorSty les.Right)

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

Me.txtURL.Name = "txtURL"

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

Me.txtURL.TabIn dex = 2

Me.txtURL.Text = ""

'

'Label1

'

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

Me.Label1.Name = "Label1"

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

Me.Label1.TabIn dex = 3

Me.Label1.Text = "URL"

Me.Label1.TextA lign = System.Drawing. ContentAlignmen t.MiddleRight

'

'Form1

'

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

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

Me.Controls.Add Range(New System.Windows. Forms.Control() {Me.Label1,
Me.txtURL, Me.btnGetSource , Me.txtPageSourc e})

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

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

End Sub

Private Sub btnGetSource_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnGetSource.Cl ick

Dim inputURL, WebPageSourceCo de As String

Dim WebPage As HttpWebRequest

Dim WebPageText As WebResponse

Dim WebPageSource As Stream

Dim WebPageSourceTe xt As StreamReader

On Error GoTo ErrorHandler

txtPageSource.T ext = ""

inputURL = txtURL.Text

WebPage = WebRequest.Crea te(inputURL)

WebPageText = WebPage.GetResp onse()

WebPageSource = WebPageText.Get ResponseStream

WebPageSourceTe xt = New StreamReader(We bPageSource,
System.Text.Enc oding.ASCII)

WebPageSourceCo de = WebPageSourceTe xt.ReadToEnd()

WebPageSourceTe xt.Close()

WebPageSource.C lose()

txtPageSource.T ext = WebPageSourceCo de

Exit Sub

ErrorHandler:

MsgBox("Invalid URL or page not available")

Exit Sub

End Sub

End Class
"John Bradley" <br*****@jabtec h.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.htm l

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
565
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 machine(gsm or pocket pc which include bluetooh) read data and see this data in my program(client side).. In addition client side program read data from internet.. Can i do this with .net and which project type do i use? "Asp .net mobile web...
4
4440
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 strings' instead of 'one liners' I check the streams for terminators. I'm having problems with the connection, I've been looking and debugging for 2 weeks now (debugging with an emulator is terribly slow..) but I'm not getting it...
2
3540
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 cells with data. I have followed this web page's instruction (http://www.haneng.com/Forums_Post.asp?id=4099) to read data out, but whenever the cell has checkbox or it is a merged cell, it can't read the data. Is there anyway to read data...
4
7789
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. What I need to do is read the page (without the user seeing it if possible) search for certain words and get that row of data. example: table looks like this: docNumber FileName ---------------------------------
12
6607
by: Ron | last post by:
What is the VB equivalent of the READ...DATA statements in QuickBasic? Thanks
5
15732
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 to read data from the transport connection" when restart reading the stream with socket.BeginRead in the Sub SocketIncomingMsg. I'm debugging now for weeks, but I can't detect where it's
4
11050
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 "load" page. I would like to use these data (which I presume is in some form of html or xml) in my HTML portion of the asp page. The data must be read using java script and after lots of calculations perform on it - be written to xml controls. I can...
2
10696
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 not allowed. This is done so that users cannot take away a copy of the .exe file. When I execute the ..exe from the client computer I get .Net Framework Initialization Error, Unable to find a version of the runtime to run this application. The...
1
1924
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 on server and our networked database in in place. However, as a went to save my Form as a Data Page...i recieved an error. "Microsoft office access is unable to create the data access page" "The file does not exist, or you do not have read...
1
6737
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. Here is what I have to do. The user after logging into a password protected website keys in a shipper number which outputs data and from there I have to read that page and grab value from there. My question is this: 1. How do I tell access to...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.