0

i am currently making a program, which downloads files from gerrit automatically. however i tried to make the program full automatically, but could not find out how to make ie object to download a file automatically without pressing download file popups. i tried so many ways to make it happen, but couldn't solve it. so i just gave up this way and choose to make program that user should press download button manually.

now i got new problem.

this program should open newly downloaded file and don't know how to get newly downloaded filepath from ie object.

after clicking download file button in ie, how can i get recently downloaded filepath from ie object in C#?? could someone tell me how?

user2809760
  • 53
  • 1
  • 3
  • 5
  • [How do I determine the Windows 'Download folder' path?](http://stackoverflow.com/questions/7672774/how-do-i-determine-the-windows-download-folder-path) – Damith Oct 14 '13 at 02:26
  • 1
    Why are you even using IE for this? You can just use `WebClient` in C# - it's a lot simpler that way and you get to control where files are downloaded. – xxbbcc Oct 14 '13 at 02:27

1 Answers1

0

You can use WebClient to download file and skip IE altogether

Example:

using (WebClient webClient = new WebClient())
{
    webClient.DownloadFile("http://myFile.com", "C:\\Downloads\MyFile.iso");
}

Or Async (.NET4.5)

using (WebClient webClient = new WebClient())
{
   await webClient.DownloadFileTaskAsync("http://myFile.com", "C:\\Downloads\\MyFile.iso");
}
sa_ddam213
  • 42,848
  • 7
  • 101
  • 110