ASP.NET cookie不写?重定向问题?

时间:2015-09-17 10:59:48

标签: asp.net

我有以下代码:

                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是?有什么想法吗?

0 个答案:

没有答案