I am working on a project where I need to automate IE. I am writing the application in C# and controlling the browser using the InternetExplorer object (SHDocVw.dll). So far I have been able to do everything I need to do (navigate to a particular site/page, manipulate elements on the page, populate form objects, submit forms, etc.). However, I would like to be able to automate the process of saving files that are linked on a site. For instance on the website are links to .pdf files, .csv files, word files, excel files, images, etc. that I need to download to the local drive. If I attempt to access the files by their URL/Path on the website, the browser spawns the Open/Save dialog box, of which I have not been able to determine how to interact with. And the "Always ask this" checkbox doesn't seem to make a difference.
I do not think I can use .NET's WebRequest/HttpWebRequest objects because I need to automate a login process on the site in order to access the files. That's why I'm using IE Automation. I cannot use WSH (Windows Scripting Host) as this application does contain other business rules and specialized functionality.
Basically my questions are:
1. using IE Automation (using the InternetExplorer object) can I download files (text or binary) from a site to the local machine. Whether I interact with the Open/Save dialog box spawned by IE or access and download the files via another means, I do not care.
2. When IE spawns a dialog window (i.e. Open/Save, Windows Authentication, etc.) how can you interact with it (i.e. click "Save", fill in the login/password boxes, etc.).
If you know of a better way to do what I'm trying to do, please let me know.
I appreciate your help. Thanks.