views:

58

answers:

3

Hi all,

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.

A: 

you can't suppress the file download dialog as that it would be a major security risk. I would suggest you investigate other routes to get your request authenticated if you want to make this process automatic.

Alex
It really wouldn't be that big of a security risk, right? Since I am required to authenticate myself first before downloading it.
icemanind
A: 

Check Webbrowser Control Downloads

Sheng Jiang 蒋晟
A: 

Sheng Jiang's solutions is the best if you are familiar with the C++ internals.

Otherwise have a look how the iMacros for Internet Explorer (= freeware browser macro recorder addon) does it. It seems they use Windows hooks to suppress the IE download dialog.

Ruby8848