title: How to Get Cookie JSESSIONID in WebClient
body: <p>I have implemented following method to get JsessioniD from the Cookies. WebSite uses form authentication. </p>
  
  <p>Here is what I have implemented.</p>
  
  <pre><code>public override void ViewDidLoad ()
      {
          base.ViewDidLoad ();
          using(var client= new CookieAwareWebClient())
          {
             var values= new NameValueCollection
             {
               {"username","admin"},
               {"password","admin"},
             };
              client.UploadValues("myURL/j_security_check",values);
              WebHeaderCollection myWebHeaderCollection = client.ResponseHeaders;
  
              for (int i=0; i &lt; myWebHeaderCollection.Count; i++)             
  Console.WriteLine ("\t" + myWebHeaderCollection.GetKey(i) + " = " + myWebHeaderCollection.Get(i));
          };
      }
  </code></pre>
  
  <p>CookieAwareWebClient Class is implemented as follows:</p>
  
  <pre><code>public class CookieAwareWebClient : WebClient
    {
  
     public CookieAwareWebClient()
      {
         CookieContainer = new CookieContainer();
      }
  
      public CookieContainer CookieContainer { get; private set; }
  
      protected override WebRequest GetWebRequest(Uri address)
      {
          var request = (HttpWebRequest)base.GetWebRequest(address);
          request.CookieContainer = CookieContainer;
          return request;
      }
    }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ecKPe.png" alt="enter image description here"></p>
  
  <p>My question is how to get only JsessionID?</p>