我有以下代码:
var serializer = new XmlSerializer(typeof(classes.Member));
TextWriter writer = new StringWriter();
serializer.Serialize(writer, active_resident);
HttpCookie cookie = Request.Cookies["ActiveUser"];
if (cookie == null)
{
cookie = new HttpCookie("ActiveUser");
}
cookie.Expires = DateTime.Now.AddHours(1);
cookie.Value = Genesis.Encryption.EncryptAES(writer.ToString(), Genesis.Generic.ReadAppSettingsValue("GenesisEncryptionKey"));
Response.Cookies.Add(cookie);
writer.Close();
// Redirect to Secure Area
Response.Redirect("secure/dashboard.aspx", false);
奇怪的是,cookie不是写的?但是,ASP.Net Session cookie是?有什么想法吗?