The objective: - Server side: Write a file to the response stream after verifying credentials. In other words, no public access to the file. - Client side: Download this file by from http://xyz.com?credentials=abc
So far, the ASPX page does the following:
What is the best way to download this file data from a WinForms app?
The simplest approach would be to use WebClient
:
WebClient wc = new WebClient();
wc.DownloadFile(url, filename);
(Either start this not in the UI thread, or use the async version. You don't want your UI thread to block while downloading.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.