public class BaseCookies
{
#region Cookies
public static void SetCookieValue(string key, string value)
{
HttpCookie cookie = new HttpCookie(key, value);
cookie.Expires = DateTime.Now.AddDays(30);
//cookie.HttpOnly = true;
HttpContext.Current.Response.Cookies.Add(cookie);
}
public static string GetCookieValue(string key)
{
if (HttpContext.Current.Request.Cookies[key] == null)
{
return string.Empty;
}
else
{
return HttpContext.Current.Request.Cookies[key].Value;
}
}
#endregion
}

相关文章:

  • 2021-07-17
  • 2021-10-31
  • 2021-12-19
  • 2021-09-22
  • 2021-09-24
  • 2021-12-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
  • 2021-06-23
相关资源
相似解决方案