写入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");

 

相关文章:

  • 2021-12-04
  • 2021-07-19
  • 2021-04-24
  • 2022-02-05
  • 2021-06-13
  • 2021-10-29
猜你喜欢
  • 2022-12-23
  • 2021-12-19
  • 2021-12-19
  • 2021-06-17
相关资源
相似解决方案