i want download file starting new process of chrome. i've found parameter "--download", solution should "chromepath --download uri". ( http://peter.sh/experiments/chromium-command-line-switches/#download )
i wrote code start process in c#, , yes, know there other options webclient, don't want implement download per se in code.
string fileuri = "example.org/file.png"; system.diagnostics.process prozess = new system.diagnostics.process(); prozess.startinfo.filename = @"c:\program files (x86)\google\chrome\application\chrome.exe"; prozess.startinfo.arguments = "--download " + fileuri; prozess.start();
this works without problem, opening link "file://fileuri". can't download without user interaction.
chrome downloads download folder. try latest download file, this:
new directoryinfo(path.combine(environment.getfolderpath(environment.specialfolder.userprofile),"downloads")) .getfiles() .orderbydescending(f => f.creationtime) .first()
this has risks (as outlined davidg) fact user might download file, etc. not best way.