WebBrowser - download page without displaying it
hi, my app have to visit many pages and i want to optimize it a little bit,
i have already disabled images/videos/sounds downloading(i care only about html content), is there a way to download page with webbrowser but do not display it ? i am well aware of httpwebrequest etc. but html content downloaded this way is different from browser source code of website, probably something with ajax etc
EDIT:
solution where i dont need webbrowser, and downloaded html content will be exactly the same as browser source will be much more appreciated :)
Re: WebBrowser - download page without displaying it
You can do this from the code-behind to get the HTML of a webpage...
Code:
private void button1_Click(object sender, EventArgs e)
{
WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
}
void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser b = (WebBrowser)sender;
string response = b.DocumentText;
// response will now contain the HTML from the page.
}