How to get source displayed by axshdocvw.dll as string

  • Thread starter Thread starter Ken Arway
  • Start date Start date
K

Ken Arway

Using VS2003, .NET1.1 and C# windows form app, I'm successfully displaying
web pages using the axshdocvw.dll. Now I want to capture the source
displayed in the window as a text string. Any ideas? I can't find any
properties or methods that will do this...

Thanks,
Ken
 
If I am correctly interpreting this, you want to get the source behind
the loaded page, right ?

If yes, import the HTML Object library (mshtml.dll). Load the page
into browser using webbrowser1.navigate2, catch an event that will
tell the state that the page is loaded completely

And then

Dim doc As HTMLDocument
Set doc = WebBrowser1.Document

msgbox(doc.childNodes(0).innerHTML)

HTH
Kalpesh
 
Thanks for the response. I've found an earlier post from Justin Rogers
which also solves the problem:
string contents = null;
string url = "http://www.microsoft.com";
HttpWebRequest wreq = (HttpWebRequest) WebRequest.Create(url);
using(HttpWebResponse wresp = (HttpWebResponse) wreq.GetResponse()) {
using(StreamReader sr = new StreamReader(wresp.GetResponseStream())) {
contents = sr.ReadToEnd();
sr.Close();
}
wresp.Close();
}

Ken
 
Back
Top