0

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

Arun
  • 3,478
  • 8
  • 33
  • 46

3 Answers3

2

You can use the SaveToString() method.

Lets say we've WebBrowser name as webBrowser1.

string htmlContent=webBrowser1.SaveToString();

Thanks

Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
1

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.

jack moseley
  • 439
  • 4
  • 12
0

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#

Community
  • 1
  • 1
Igor Ralic
  • 14,975
  • 4
  • 43
  • 51