473,394 Members | 1,806 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 webpage with VB app

KC
Is there a simple way to read (and parse) a webpage with a VB.net
application. Right now I can sort of read a page but it's a framed page and
the server thinks the app is a browser that can't handle frames...so I get a
message to the effect in the response.

Ken
Nov 20 '05 #1
14 8689
* "KC" <yo*@dontneed.this> scripsit:
Is there a simple way to read (and parse) a webpage with a VB.net
application. Right now I can sort of read a page but it's a framed page and
the server thinks the app is a browser that can't handle frames...so I get a
message to the effect in the response.


You can load each frame's HTML page. This will require you to know the
filename or parse the frameset. Alternatively, you can place a
WebBrowser control on your form and use this code:

\\\
Me.WebBrowser1.Navigate("http://www.over-the-moon.org/dollz")
///

In the WebBrowser's 'DocumentComplete' event handler:

\\\
Dim i As Integer
For i = 0 To Me.WebBrowser1.Document.frames.length - 1
MsgBox(Me.WebBrowser1.Document.frames(i).Document. documentElement.innerText)
Next i
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
* "KC" <yo*@dontneed.this> scripsit:
Is there a simple way to read (and parse) a webpage with a VB.net
application. Right now I can sort of read a page but it's a framed page and
the server thinks the app is a browser that can't handle frames...so I get a
message to the effect in the response.


You can load each frame's HTML page. This will require you to know the
filename or parse the frameset. Alternatively, you can place a
WebBrowser control on your form and use this code:

\\\
Me.WebBrowser1.Navigate("http://www.over-the-moon.org/dollz")
///

In the WebBrowser's 'DocumentComplete' event handler:

\\\
Dim i As Integer
For i = 0 To Me.WebBrowser1.Document.frames.length - 1
MsgBox(Me.WebBrowser1.Document.frames(i).Document. documentElement.innerText)
Next i
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Hi KC,

In addition to Herfried,

A little example,

Open a new windows application project

In the toolbox rightclick and select add/Remove items

In the customize toolbox select Com and in that Microsoft Webbrowser

When that is in the toolbox drag it to your form
Drag also a button to your form.

Then this code and you have a mini Webbrowser.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.AxWebBrowser1.Navigate2("www.google.com")
End Sub

webbrowser
http://support.microsoft.com/?kbid=311303

mshtml
http://msdn.microsoft.com/library/de...ng/hosting.asp

I hope this helps a little bit?

Cor
Nov 20 '05 #4
"KC" <yo*@dontneed.this> wrote in
news:#7**************@TK2MSFTNGP12.phx.gbl:
Is there a simple way to read (and parse) a webpage with a VB.net
application. Right now I can sort of read a page but it's a framed page
and the server thinks the app is a browser that can't handle frames...so
I get a message to the effect in the response.


It sounds like you just want to transfer it, and not display it? If so the
webbrower control is overkill and in fact can interfere. You should look at
just using straight HTTP.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 20 '05 #5
Hi Kudzu,
It sounds like you just want to transfer it, and not display it? If so the
webbrower control is overkill and in fact can interfere. You should look at just using straight HTTP.

Altough I do not disagree, are we not talking about ants on the Titanic. ;)

Cor

Nov 20 '05 #6
* "Chad Z. Hower aka Kudzu" <cp**@hower.org> scripsit:
Is there a simple way to read (and parse) a webpage with a VB.net
application. Right now I can sort of read a page but it's a framed page
and the server thinks the app is a browser that can't handle frames...so
I get a message to the effect in the response.


It sounds like you just want to transfer it, and not display it? If so the
webbrower control is overkill and in fact can interfere. You should look at
just using straight HTTP.


I agree, but then you will have to parse the frameset to get the URLs of
the pages displayed in the frames.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #7
"Cor Ligthert" <no**********@planet.nl> wrote in news:O6bHww9PEHA.640
@TK2MSFTNGP09.phx.gbl:
It sounds like you just want to transfer it, and not display it? If so the
webbrower control is overkill and in fact can interfere. You should look

at
just using straight HTTP.

Altough I do not disagree, are we not talking about ants on the Titanic. ;)


Not in this case. WebBrowser doesnt just do HTTP, or simple parsing. It loads
TONS of stuff to render etc just to do this. We are not talking about ants on
the Titanic, but rather Ants VERSUS the Titanic. :)
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 20 '05 #8
hi***************@gmx.at (Herfried K. Wagner [MVP]) wrote in
news:en**************@TK2MSFTNGP10.phx.gbl:
I agree, but then you will have to parse the frameset to get the URLs of
the pages displayed in the frames.


Yes, but thats quite a trivial task.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 20 '05 #9
Hi Kudzu,
I agree, but then you will have to parse the frameset to get the URLs of
the pages displayed in the frames.


Yes, but thats quite a trivial task.

That should be very easy when you use the logic from Mshmtl.

Something simple as let say (I did not test it, however it is not much
different))

If tagname = "iframe" Then
Url = DirectCast( DirectCast(iDocument.all.item(i), mshtml.IHTMLElement)
mshtml.IHTMLFrameBase).src.ToString
End If

:-))

Cor
Nov 20 '05 #10
* "Chad Z. Hower aka Kudzu" <cp**@hower.org> scripsit:
I agree, but then you will have to parse the frameset to get the URLs of
the pages displayed in the frames.


Yes, but thats quite a trivial task.


Mhm... but why implement it if it's already available through MSHTML?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #11
hi***************@gmx.at (Herfried K. Wagner [MVP]) wrote in
news:uC**************@TK2MSFTNGP12.phx.gbl:
Yes, but thats quite a trivial task.


Mhm... but why implement it if it's already available through MSHTML?


Because unless you are implementing just one instance in a client app,
dragging in WebBrowser will us significant resources. Its like loading up a
747 to go to the corner store for a loaf of bread.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 20 '05 #12
Hi Kudzu,

It becomes smaller, first the Titanic and now it is a 747.

:-)

Although I agree with you when the OP wants to integrate it in his program.
When he wants an basic approach he can use the webbrowser because it is so
easy to navigate with that.

Do not mix up MSHTML with the webbrowser, in my opinion that are different
things.
MSDN is not real clear about MSHTML.

You can load a doc in MSHTML and than process it using the DOM.
See for that the sample I showed in the other thread in this message.

Cor
Nov 20 '05 #13
* "Chad Z. Hower aka Kudzu" <cp**@hower.org> scripsit:
Mhm... but why implement it if it's already available through MSHTML?


Because unless you are implementing just one instance in a client app,
dragging in WebBrowser will us significant resources. Its like loading up a
747 to go to the corner store for a loaf of bread.


Full ACK. Depends on if you are lazy or not...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #14
"Cor Ligthert" <no**********@planet.nl> wrote in news:uVfXAMCQEHA.1644
@TK2MSFTNGP09.phx.gbl:
It becomes smaller, first the Titanic and now it is a 747.
Different examples. :)
Although I agree with you when the OP wants to integrate it in his program.
When he wants an basic approach he can use the webbrowser because it is so
easy to navigate with that.
If he doesnt care about weight, or for that matter dependencies. In a client
app he's probably ok.
Do not mix up MSHTML with the webbrowser, in my opinion that are different
things.
MSDN is not real clear about MSHTML.
Yes, but they are quite interreliant, and he spoke of using WebBrowser to do
the fetching.
You can load a doc in MSHTML and than process it using the DOM.


But he will get it using WebBrowser. :)

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 20 '05 #15

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

Similar topics

1
by: Kenneth Johansen | last post by:
Is there a way i can read xml from a webpage. The situation is that i have to type in an Url with some parameters (a login), when the page returns, it returns an ID that i have to use through...
5
by: John Bradley | last post by:
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...
0
by: KC | last post by:
Is there a simple way to read (and parse) a webpage with a VB.net application. Right now I can sort of read a page but it's a framed page and the server thinks the app is a browser that can't...
17
by: chris.schwalm | last post by:
I would like to first state that I have searched through the archives and found a lot of related material, but am still new enough to javascript that I can't fit all the pieces together yet. So...
1
by: Juergen Wohnich | last post by:
I want to read a webpage in chart buffer and than i want to parse it. If have found out that "CInternetSession.OpenURL" is the way to do this, but now i seraching for a complete sample. Maybe a...
5
by: bobbyd | last post by:
Hi All, Does anyone know of a way to read an output from an external webpage/service? For example; The external source is on http://serverA:6010/sendoutput This page displays one line of...
1
by: Rajen | last post by:
I've a automatic configuration proxy (http://xxx.xxx.xxx.xxx/xyz.pac) which I use in the Internet explorer Lan Settings to access the net. How do I read a webpage by specifying this proxy in my...
2
by: tovishal2001 | last post by:
Hi, I am trying to read first 6000 bytes from a webpage, using StreamReader.Read(buffer, offset, no_of_bytes_to_read) method and trying to close the connection. Because, the useful data I need is...
1
by: AroopNerd | last post by:
Can you give me any idea…. just want to read a line of text from a webpage and store it in a string variable using desktop vb.net.
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.