【发布时间】:2014-01-24 04:52:36
【问题描述】:
我创建了一段使用 WebClient 从给定 URL 下载文件的代码。
问题是当代码尝试从HTTPS 站点下载文件时出现以下错误。
The remote certificate is invalid according to the validation procedure
这个问题只发生在服务器上,不在本地机器上,所以我也不知道如何调试它。
我在网上阅读了几个答案,但没有找到任何可以帮助我的答案。
这段代码:
using (WebClient Client = new WebClient())
{
string fileName = System.Configuration.ConfigurationManager.AppSettings["siteUploadedDirectory"]
+ "/temp/" + Context.Timestamp.Ticks.ToString()
+ "_" + FileURL.Substring(FileURL.LastIndexOf('/')+1);
fileName = Server.MapPath(fileName);
Client.DownloadFile(FileURL, fileName);
return fileName + "|" + FileURL.Substring(FileURL.LastIndexOf('/')+1);
}
我正在尝试的网址:
http://Otakim.co.il/printreferrer.aspx?ReferrerBaseURL=cloudents.com
&ReferrerUserName=ram
&ReferrerUserToken=1
&FileURL=https://www.cloudents.com/d/lzodJqaBYHu/pD0nrbAtHSq
文件网址: FileURL=https://www.cloudents.com/d/lzodJqaBYHu/pD0nrbAtHSq
任何帮助将不胜感激
【问题讨论】:
标签: c# asp.net .net https webclient-download