September 16th, 2013, 02:11 PM
Override Webbrowser.FileDownload and Save Prompts
Iím developing a C# application to use the Visual Studio WebBrowser control and download documents from the web. (Iím using the Extended WebBrowser control supporting tabs Ė CSTabbedWebBrowser from
At one point in the automation sequence, I need to click on a download link to download a separate HTML document. The underlying HTML link does not contain a URL to a specific document. I believe the URL information and document are created dynamically.
When I click the link, an Open/Save/Cancel dialog popup appears. Then, when I click the Save button, a separate windows API Save As dialog appears, requesting the file save name and location.
The popups have prevented me from automating the download process so I would like to override the download process.
Can anyone help me with modifying the code for the WebBrowser control to bypass both of these dialogs and save the file to a location based upon a constant and a filename contained in a string variable?
The CSTabbedWebBrowser already has some COM programming. It attaches an event sink to the browser to override the new window event and create a new tab. I assume that I need to use C++ and COM programming to override the FileDownload events but not sure how to accomplish this and complete the download.
The underlying HTML code under the download link does not specify a URL for the downloaded file, so I canít use a c# download(URL) procedure. I believe that the HTML in the downloaded file is generated dynamically.
Iíve been trying to solve this problem for a couple of weeks. I have experience with C# but the COM/C++ it giving me a challenge.
Any assistance would be greatly appreciated.
Tags for this Thread
Click Here to Expand Forum to Full Width