/// <summary> /// 获取文件总大小 /// </summary> public void GetTotalSize() { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(this.url); //request.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight-2-b1, */*"; request.ContentType = "application/x-www-form-urlencoded"; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0"; WebResponse response = request.GetResponse(); request.Method = "HEAD"; request.Timeout = 5000; this.totalSize = response.ContentLength; }
应该是没获取到文件