My question is if this is the correct way to get the value of a cookie in c#. My intentions are only to get the value of a specific cookie and store in a string variable which i named “cookie” in the example.
WebRequest request = WebRequest.Create(url);
(request as HttpWebRequest).CookieContainer = new CookieContainer();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String cookie = response.Cookies[cookiename].ToString();
Look:
Save Cookie:
Recover cookie:
Hope this help.