Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically save an MHT without dialog

Is it possible to save a file of any type bypassing the 'save as' dialog? using the WebBrowser Class

WebBrowser.ShowSaveAsDialog();

Is the loaded content in a WebBrowser control serializable so it can be saved and retrieved (for redisplay)?

like image 220
zion Avatar asked Oct 15 '09 00:10

zion


1 Answers

Given that you have full access to the DOM and can therefore read any contents that the WebBrowser is displaying the answer must be yes.

  • Using the tree of DOM nodes read the contents of the WebBrowser into the C# world
  • Write to the file using normal .NET file access

However if you just wish to download a webpage and save it to disk there are better ways then using the WebBrowser control, have a look at the WebClient class

like image 129
Ian Ringrose Avatar answered Nov 02 '22 05:11

Ian Ringrose