Lightweight WebBrowser needed

A

AMercer

The url
http://moneycentral.msn.com/companyreport?Symbol=MMM
contains some information about a stock (3M Co in this case).

My.Computer.Network.DownloadFile() yields some html text that says the
document has moved (as found in the downloaded file).

The Net.WebRequest+Net.WebResponse recipe yields html text that contains the
general layout of the web page, but there are some omissions (as found by
reading the response stream).

Forms.WebBrowser.Navigate, after waiting for the appropriate events to fire,
yields the correct html text (as found in WebBrowser1.DocumentText).

What is going on is that some dynamic content is being handled by
WebBrowser, but the more primitive web page reading technologies just get the
original web page. WebBrowser presumably runs scripts and so forth to get
the job done.

What I want is a lightweight version of WebBrowser. I need the final html
text that results from WebBrowser (or IE) doing its thing, but I don't need
any presentation. I want to ask for the html text for a url, and I want to
receive the same text that IE delivers to you when you right click and then
do "view source".

Does anybody know how to do this? FYI, some of the web sites I am
interested in are old and thus are not xml compliant.
 
C

Cowboy \(Gregory A. Beamer\)

If you want it simple, you will have to use the web browser control. You can
examine what is returned and see the redirect and respond to it quite easily
that way.

If you want the hard way, you can certainly work with HttpRequest and
HttpResponse and build your own. You still have the option of ripping
through strings using this method.

If you want to look at some code, you might try this:
http://www.codeproject.com/KB/recipes/IE7_Clone_VS2005_Browser.aspx

Not the exact features you need, but it gives you a feel of the control, if
you go that route. If you want to work with System.Net classes, you might do
better with something like this:
http://www.vbdotnetheaven.com/UploadFile/mahesh/DownloadWebPage04252005073432AM/DownloadWebPage.aspx

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

*************************************************
| Think outside the box! |
*************************************************
 
A

AMercer

Thanks for the reply. I'm familiar with the 2nd link. 1st link looks
interesting, and I think I'll pick up some tricks there. Absent another
suggestion, I think I'm headed towards using WebBrowser for my problem
downloads. I'll probably put a WebBrowser on a form that is invisible and
use it like an async download utility.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top