Click here to Skip to main content
14,386,033 members
Rate this:
Please Sign up or sign in to 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 3:56am
v4
Rate this:
Please Sign up or sign in to vote.

Solution 2

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.
   
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 )
Rate this:
Please Sign up or sign in to vote.

Solution 1

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
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100