add cookie to WebClient

c#

Solution

You can add cookies to your webClient.

webClient.Headers.Add(HttpRequestHeader.Cookie, "cookies");
webClient.DownloadFile("http://........", "C://2.pdf");

Problem

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"); ```

Original source

Related problems