我需要一些方法来检查下载的大小,而无需下载整个文件.我正在使用C#和System.Net.WebClient进行下载.检查需要在asp.net webservice中运行.
谢谢
使用HTTP方法HEAD检索Content-Length:标头.
HEAD / HTTP/1.1 Host: www.example.com HTTP/1.1 200 OK Date: Wed, 18 Mar 2009 11:21:51 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT ETag: "b80f4-1b6-80bfd280" Accept-Ranges: bytes Content-Length: 438 Connection: close Content-Type: text/html; charset=UTF-8