我最近想做个登陆,对cookies不是很了解,希望大家能给与我帮助,涉及cookies的其他知识也可以说。
------解决方案--------------------------------------------------------
- C# code
string roles = "Job_System";FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, strAccount, DateTime.Now, DateTime.Now.AddMinutes(30), false, roles);string encryptedTicket = FormsAuthentication.Encrypt(authTicket); //加密 HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);Context.Response.Cookies.Add(UserCookie); //写入
------解决方案--------------------------------------------------------
完整教程
ASP.NET Cookie 概述
http://msdn.microsoft.com/zh-cn/library/ms178194%28VS.80%29.aspx