C#Internet Explorer自动化单击C#复杂网站下载上的SaveAs

问题描述:

我正在导航到一个安全的网站,我需要单击一个文件将其另存为,并且我正在尝试与对话框进行交互以另存为某个文件.

不知道如何使用C#自动单击另存为"按钮-

任何帮助将不胜感激

谢谢

I am navigating to a secure website and i need to click on a file to save it as and I am trying to interact with the dialog box to save as a certain file

Dont know how to automatically click on save as button using C# -

Any help would be greatly appreciated

Thanks

如果您使用的是Webbrowser控件,则可以在控件的document属性的links集合中找到要下载的链接,并使用

新的System.Net.WebClient().DownloadFile(myurl,myfilename)

那么您就不需要另存为"对话框.
if you are using a webbrowser control you can find the link you want to download in the links collection of the document property of the control and use

new System.Net.WebClient().DownloadFile(myurl,myfilename)

then you don''t need the save as dialog box.


文件对话框与保存"本身(文件I/O)无关,它们只是帮助用户定义文件名.

如果在某些保留目录中创建用于命名文件的模式,请使用它.创建一个设置该目录的配置文件(相对于特殊目录,例如用户"Application Data"和名称模式)(例如,带有订购号和/或日期/时间的格式为排序"格式("s")) ).以这种方式确定文件名并保存.

—SA
File dialog boxes have nothing to do with "Save" itself (File I/O), they simply help the user to define a file name.

If you create some pattern for naming file in some reserved directory, use it. Create a configuration file setting up such directory (better relative to special directory such as users "Application Data" and pattern for names (for example, with the format with ordering number and or date/time is "sorted" format ("s")). Determine a file name in this way and save.

—SA