I have a WebBrowser control that is automatically logging me into a website and attempting to download CSV data automatically. Everything is working fine, except, when it tries to download the CSV data, it is popping up a dialog box, asking if I want to save the file or open it (just like in IE). What I am trying to do is automatically download the CSV file to a file of my choosing (or better, save the CSV file directly into a string variable). I can't seem to figure out how to suppress the dialog box and capture the download automatically. I've search and found a few solutions, however, they don't work for me because:
1) I am now using a GUI. All this is done in a class (therefore, methods such as SendKeys would not be a viable solution)
2) The download comes from a secure site and requires authentication. The WebBrowser control handles all that for me, but if I use a WebRequest and WebResponse to try to capture the download, I am no longer authenticated.
I am using C#. Any help would be appreciated.
You can hook up your own IDownloadManager implementation that does download quietly. For Windows Forms, this means you need to override the WebBrowser.CreateWebBrowserSiteBase method to provide your extended control site. Check Webbrowser Control Downloads for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With