写入Cookie
var CookieOption = new CookieOptions();CookieOption.Path = "/";//on localhost, Domain value is not needed !!CookieOption.Domain = "";CookieOption.Expires = DateTime.Now.AddHours(1);CookieOption.HttpOnly = true; //set cookieContext.Response.Cookies.Append("TestCookie", "Testing", CookieOption);
读取Cookie
string testCookie = Context.Request.Cookies.Get("TestCookie");