Download a webpage as HTML

justice8965

New member
Joined
Mar 26, 2010
Messages
2
Programming Experience
1-3
Hey all

Probably a simple question but I cant figure it out. I have a webbrowser control, which navigates to a URL where it logs in, then a different URL where theres some information I need. I would like to save this page as an HTML document. I can navigate to the page easily, so is there any way to tell the webbrowser to save the current page as an HTML document?
 
Write to a file

You need to imort System.IO
The webbrowser has a property DocumentText this is the full html as it is downloaded by it. So you can use the following function to write it to a file.

File.WriteAllText(FilePath, WebBrowser.DocumentText)
 
Back
Top