先上代码
string url = string.Format(“https://www.quandl.com/api/v3/datasets/WIKI/{0}.csv?api_key={1}”, code, “XXXXX2AGcF”);
WebClient client = new WebClient();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
client.DownloadFile(new Uri(url), name);
url中的key是在quandl官网申请的账号给出的秘钥;
name是要保存的 路径+要保存的文件名+后缀(CSV);
第三行代码是解决https的SSl通道问题。