ylbtech-System.Web.HttpCookie.cs |
1.程序集 System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a返回顶部 |
1、
#region 程序集 System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a // C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5.2System.Web.dll #endregion using System.Collections.Specialized; using System.Reflection; namespace System.Web { [DefaultMember("Item")] public sealed class HttpCookie { public HttpCookie(string name); public HttpCookie(string name, string value); public string this[string key] { get; set; } public string Name { get; set; } public string Path { get; set; } public bool Secure { get; set; } public bool Shareable { get; set; } public bool HttpOnly { get; set; } public string Domain { get; set; } public DateTime Expires { get; set; } public string Value { get; set; } public bool HasKeys { get; } public NameValueCollection Values { get; } } }
2、
2. 示例返回顶部 |
1、WebForm
HttpCookie cookie = new HttpCookie("Mobile", "13520690000"); //创建一个Cookie cookie.Expires = DateTime.Now.AddMinutes(3); //设置过期日期和时间 Response.Cookies.Add(cookie); //添加Cookie
2、API 有问题
#region 权限设置 HttpCookie cookie = new HttpCookie("cu_mobile", Mobile); //创建一个Cookie if (entity.Status == 0 || entity.Status == 3) { cookie.Expires = DateTime.Now.AddHours(8).AddMinutes(10); //设置过期日期和时间 } else { cookie.Expires = DateTime.Now.AddMinutes(-1); //设置过期日期和时间 } Response.Cookies.Add(cookie); //添加Cookie #endregion
3、
3.返回顶部 |
4.返回顶部 |
5.返回顶部 |
6.返回顶部 |
![]() |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |