c# - Download a file using URL in WPF Application without opening browser -


this question has answer here:

is possible download file using download link url using c# wpf application without opening browser? example: link - http://example.url.com when typed address bar of browser automatically downloads file. how can download file upon button click in wpf application (c#) without opening browser?

tia.

you can use webclient.downloadfile, if want download specific file , store on machine:

using (webclient client = new webclient()) {     client.downloadfile(remotefilename, localfilename);     ... } 

or webclient.downloadstring, if want page's content string:

using (webclient client = new webclient()) {     string reply = client.downloadstring (address);     ... } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -