views:

382

answers:

2

Does anybody know if you can access the SaevFileDialog control that's used by the WebBrowser control? Once somebody saves the webpage being displayed I need to catch where the files have been created; however I can't seem to find any events/members that allow me access to that information.

A: 

I'm pretty sure that you cannot access the Save As dialog that is provided by the WebBrowser control.

I'm not sure if you're writing a WinForms application or an ASP.Net application, but since you're using a WebBrowser control, I'm assuming that you're writing a WinForms application in which you want to show some HTML content.

In this case, if I wanted the end user to save to a specific location on their disk, I would provide my own Save button and in the button's Click event, I would read the text of the HTML displayed in the browser control (which can be done easily) and pass it to a System.IO.StreamWriter to save the contents to that file.

If you want to have the customers select where to save, then use a SaveFileDialog of your own in the button's Click event.

David Stratton
I thought about doing that; the problem is that I need to save all of the images as the standard webbrowser save dialog saves them; it seems a bit of a shame to have to reproduce functionality that already exists simply because the webbrowser control doesn't allow access to its dialog events.
Dale
WATIN could be a good choice.
ajl
A: 

I agree with the first post in that you should create your own save button and stream the html document to file. This provides much more control. Alternatively, you can use WATIN for all sorts of cool stuff, including managing file download dialog boxes and events.

ajl