Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add cookie to WebClient

Tags:

c#

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");
like image 304
Masoud Sadeg Avatar asked Nov 07 '12 17:11

Masoud Sadeg


1 Answers

You can add cookies to your webClient.

webClient.Headers.Add(HttpRequestHeader.Cookie, "cookies");
webClient.DownloadFile("http://........", "C://2.pdf");
like image 140
Asif Mushtaq Avatar answered Nov 04 '22 02:11

Asif Mushtaq