添加cookie来的WebClient [英] add cookie to WebClient
本文介绍了添加cookie来的WebClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想下载PDF与 Web客户端
,但我需要请求发送的cookie
如何添加的cookie Web客户端
然后下载PDF
Web客户端Web客户端=新的WebClient();
webClient.DownloadFile(HTTP:// ........,C://2.pdf);
解决方案
您可以添加cookies来你的Web客户端。
webClient.Headers.Add(HttpRequestHeader.Cookie,曲奇);
webClient.DownloadFile(HTTP:// ........,C://2.pdf);
I want download pdf with WebClient
but I need send cookie with request
How can add cookie to WebClient
then download pdf
WebClient webClient = new WebClient();
webClient.DownloadFile("http://........", "C://2.pdf");
解决方案
You can add cookies to your webClient.
webClient.Headers.Add(HttpRequestHeader.Cookie, "cookies");
webClient.DownloadFile("http://........", "C://2.pdf");
这篇关于添加cookie来的WebClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文