Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 C# 在网站上下载文件并使用 progressBar 显示其下载百分比。我知道我可以使用以下代码来获取本地文件的大小,但是我如何知道网站上发布的文件的大小?
FileInfo finfo = new FileInfo(strFilePath); int length = (int)finfo.Length;
当您开始下载时,服务器应该发送一个Content-length标头,告诉您文件有多大。
Content-length