Hi All,
I want to get value from the header.
Means when I pass the parameter from header, I need the value using key from the headers.
- WebClient webClient = new WebClient();
- webClient.QueryString.Add("param1", "value1");
- webClient.QueryString.Add("param2", "value2");
- string result = webClient.DownloadString("http://theurl.com");

Piyush PansuriyaRank #454 · 5.5K reputationPosted Oct 12, 2018, 3:39 AM EDT
Ruchi SharavatRank #1,714 · 885 reputationPosted Oct 12, 2018, 3:37 AM EDT
Ruchi SharavatRank #1,714 · 885 reputationPosted Oct 12, 2018, 3:43 AM EDT
Are you looking for specific key?if (webClient.ResponseHeaders.TryGetValues("yourkey", out values)) { string keyval= values.First(); }use this for specific key.Ruchi SharavatRank #1,714 · 885 reputationPosted Oct 12, 2018, 3:31 AM EDT
If the header already exists:
webClient.Headers.Set("key", "value");if its a new header:
webClient.Headers.Add("key", "value");Rohan Ramani146 reputationPosted Oct 12, 2018, 3:33 AM EDT
Rohan Ramani146 reputationPosted Oct 12, 2018, 3:39 AM EDT
Rohan Ramani146 reputationPosted Oct 12, 2018, 3:42 AM EDT