C# 下载的是HTML页面而不是ZIP文件

C# 下载的是HTML页面而不是ZIP文件,c#,webclient,C#,Webclient,如何下载使用C#列出的zip文件之一 我试过了 WebClient webClient = new WebClient(); webClient.DownloadFile("http://www.tneu.edu.ua/engine/download.php?id=801", "local.zip"); 但是在执行DownloadFile()方法之后,“local.zip”会收到一个HTML页面,而不是实际的zip文件 当鼠标单击浏览器中的相应链接时,可以轻松下载zip文件。 但是,当我将链接

如何下载使用C#列出的zip文件之一

我试过了

WebClient webClient = new WebClient();
webClient.DownloadFile("http://www.tneu.edu.ua/engine/download.php?id=801", "local.zip");
但是在执行DownloadFile()方法之后,“local.zip”会收到一个HTML页面,而不是实际的zip文件

当鼠标单击浏览器中的相应链接时,可以轻松下载zip文件。 但是,当我将链接url“”复制并粘贴到浏览器时,它也会将我重定向到根页面

我感谢你的帮助

此代码执行以下操作:

WebClient webClient = new WebClient();
webClient.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate,sdch");
webClient.Headers.Add(HttpRequestHeader.Referer, "http://www.tneu.edu.ua/study/timetable/");
webClient.DownloadFile("http://www.tneu.edu.ua/engine/download.php?id=801", "local.zip");
显然,该网站只希望您从该特定页面下载,因此您需要请求该页面,就像您是从该页面被引用一样。

此代码用于:

WebClient webClient = new WebClient();
webClient.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate,sdch");
webClient.Headers.Add(HttpRequestHeader.Referer, "http://www.tneu.edu.ua/study/timetable/");
webClient.DownloadFile("http://www.tneu.edu.ua/engine/download.php?id=801", "local.zip");
显然,该网站只希望您从该特定页面下载,因此您需要请求该页面,就像您是从该页面被引用一样。

此代码用于:

WebClient webClient = new WebClient();
webClient.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate,sdch");
webClient.Headers.Add(HttpRequestHeader.Referer, "http://www.tneu.edu.ua/study/timetable/");
webClient.DownloadFile("http://www.tneu.edu.ua/engine/download.php?id=801", "local.zip");
显然,该网站只希望您从该特定页面下载,因此您需要请求该页面,就像您是从该页面被引用一样。

此代码用于:

WebClient webClient = new WebClient();
webClient.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate,sdch");
webClient.Headers.Add(HttpRequestHeader.Referer, "http://www.tneu.edu.ua/study/timetable/");
webClient.DownloadFile("http://www.tneu.edu.ua/engine/download.php?id=801", "local.zip");

显然,该网站只希望您从该特定页面下载,因此您需要请求它,就好像您是从那里被引用的一样。

是的,但在粘贴中出错了,一秒钟我会修复。是的,但在粘贴中出错了,一秒钟我会修复。是的,但在粘贴中出错了,一秒钟我会修复。