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:
- Verify credentials
- this.Response.ContentType = “application/octet-stream”;
- this.Response.BinaryWrite(binaryReader.ReadBytes(1024));
What is the best way to download this file data from a WinForms app?
The simplest approach would be to use
WebClient:(Either start this not in the UI thread, or use the async version. You don’t want your UI thread to block while downloading.)