简体   繁体   中英

C# winforms client: How can I download file under conditions validated on server side?

In our solution we have a winforms client and a web application with a database. We use WCF as the main way to communicate and perform certain actions on the server and all works well but now we need to implement a way to download fairly large files (~ couple of 100MB) under conditions that need to be validated on the server side (otherwise bypassing the client would enable unconditional downloads).

The most obvious and desirable solution (at least for the validation part) is a WCF service. But for downloading files configuration seems quite involved when it comes to large files, and there are important settings and options that I would not be comfortable to deploy without fully understanding them.

With WebRequest or WebClient I cannot see any way to perform validation on the server.

Is there any simple way to achieve this?

If WCF is the way can anyone show me how to implement this correctly and safely?

WCF allows to stream response so you can use it to download large file/data set. Please read this article to learn how to work with streaming. The same but in another words and with sample code: Streaming files over WCF

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM