Click here to Skip to main content
15,889,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 13-Jul-11 2:56am
v4

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.
 
Share this answer
 
Comments
jgiami2402 12-Jul-11 16:17pm    
Thanks

When i do that the file downloaded is protected and the file is not the same one than when I click on save as. The website is a secured website and it looks like they filter the file when i use System.Net.WebClient().DownloadFile(myurl,myfilename)
cechode 13-Jul-11 13:30pm    
is the click bound to some jscript? ( if so you can invoke that directly as well )
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
 
Share this answer
 
Comments
jgiami2402 12-Jul-11 14:53pm    
Thank you so much for your reply,

How Do you automatically click on the save button using C# ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900