0
votes

I am developing a windows phone 7 application. I am using webbrowser control in my application. I want to get the HTML code of the content that I am loading in the webbrowser control. I need to parse the HTML content to do someother functions. So how can I get the HTML code of the content that I am displaying in the webbrowser control ?. Please help.

Thanks

3

3 Answers

2
votes

You can use the SaveToString() method.

Lets say we've WebBrowser name as webBrowser1.

string htmlContent=webBrowser1.SaveToString();

Thanks

1
votes

You can use the SaveAsString() Method on the WebBrowser control, and that will give you the HTML of the page currently set as the source.

0
votes

You could perhaps get the source of webbrowser control by getting the webbrowser.Source property.

Then when you have it (source, url), you can download it using WebClient

See here for an example of using WebClient for downloading HTML

How can I download HTML source in C#