asp.net5 操作Cookie
写入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 cookie Context.Response.Cookies.Append("TestCookie", "Testing", CookieOption);
读取Cookie
string testCookie = Context.Request.Cookies.Get("TestCookie");