Reputation: 3456
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
Upvotes: 0
Views: 1596
Reputation: 21
You can use the SaveToString()
method.
Lets say we've WebBrowser
name as webBrowser1
.
string htmlContent=webBrowser1.SaveToString();
Thanks
Upvotes: 2
Reputation: 429
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.
Upvotes: 1
Reputation: 15006
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#
Upvotes: 0