string remoteFile = "the uri of the file";
WebRequest thisRsq = WebRequest.Create(remoteFile);
WebResponse thisRsp;
try
{
thisRsp = thisRsq.GetResponse();
}
catch
{
localFile.Delete();
return;
}
int remoteSize = Convert.ToInt32(thisRsp.Headers.GetValues("Content-Length")[0]);
thisRsp.Close();

解决方案 »

  1.   

    你可以用一个很大的文件做测试
    我给的catch{}部分的代码你得改成别的或者置空
      

  2.   

    string remoteFile = "the uri of the file";
    WebRequest thisRsq = WebRequest.Create(remoteFile);
    WebResponse thisRsp = thisRsp = thisRsq.GetResponse();MessageBox(thisRsp.content-Length.tostring());
      

  3.   

    http://www.csdn.net/develop/Read_Article.asp?id=26171