Table of Contents


Cookie

Using the Cookie class, you can easily manage cookies, create, modify or remove them.

To create a new Cookie: 

var sampleCookie = new HttpCookie("myCookie","my cookie value");
Cookie.SetCookie(sampleCookie);

 

To access Cookies and Cookie value(s):

//value will be: "my cookie value"
var value = Cookie.GetCookieValue("myCookie");

//Retrieve the HttpCookie object
var sampleCookie = Cookie.GetCookie("myCookie");

//Retrieve a specific value, if cookie has multiple values. Second parameter is value key.
var value2 = Cookie.GetCookieValue("myOtherCookie","Option2");

 

To remove a Cookie:

​Cookie.RemoveCookie("myCookie");