title: How to set cookie in request header for REST service
body: <p>I am developing webservice which calls REST service and as per requirement I need to set cookie in the request header. EVen if I set everything , it gives me "401 Unauthorized message" as response.</p>
  
  <pre><code> var request = (HttpWebRequest)HttpWebRequest.Create("https://TESTRestAPI/service/1/sub");
   request.Headers.Add("Authorization", "Basic" + Encoded);
   request.Method = "GET";
   request.ContentType = "application/json";
   var response = (WebResponse)request.GetResponse();
  
  So far I tried this :-
  1. request.Headers["Cookie"] = "BasicAuth=fromTest";
  2. request.CookieContainer = new CookieContainer();
     Uri target = new Uri("https://TESTRestAPI/service/1/sub"););
     Cookie ck = new Cookie("BasicAuth","fromTest") { Domain = target.Host };
  </code></pre>
  
  <p>This is first time I am calling REST service, any help appreciated.</p>