为什么WebResponse内容长度返回-1 c#

时间:2017-09-30 17:27:39

标签: c#-4.0

我试图从任何网站下载视频,因为我需要视频网址流,但在网络响应中,我总是得到-1流,我不知道..... plzz帮帮我

WebRequest request = WebRequest.Create(selecturl);
            string l=request.ToString();
            MessageBox.Show(l + " webrequest  ");
            WebResponse response = request.GetResponse();
            MessageBox.Show( request.Method = "Get");
            Stream stream = response.GetResponseStream();
           // StreamReader streamReader = new StreamReader(stream);

           //Download in chunks
          int k = stream.ReadByte();
        MessageBox.Show(k + " ");

            byte[] buffer = new byte[1024];
        //get Total size

            MessageBox.Show(response.ContentLength.ToString());

0 个答案:

没有答案