Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么我有2个ASPXAUTH cookie而不是1个?_C#_Asp.net_Visual Studio 2010_Authentication_.aspxauth - Fatal编程技术网

C# 为什么我有2个ASPXAUTH cookie而不是1个?

C# 为什么我有2个ASPXAUTH cookie而不是1个?,c#,asp.net,visual-studio-2010,authentication,.aspxauth,C#,Asp.net,Visual Studio 2010,Authentication,.aspxauth,我正在创建一个asp.net应用程序,它现在已经可以运行了,但问题是当我使用“Live HTTP Header”时,我发现我的站点有2个ASPXAUTH cookie,正在使用的是底部的一个 在这里,我用屏幕截图展示我的发现: 顺便说一句,以下是我在登录页面中的一些代码: string email = tbEmail.Text; string pass = tbPass.Text; bool remember = cbReme

我正在创建一个asp.net应用程序,它现在已经可以运行了,但问题是当我使用“Live HTTP Header”时,我发现我的站点有2个ASPXAUTH cookie,正在使用的是底部的一个

在这里,我用屏幕截图展示我的发现:

顺便说一句,以下是我在登录页面中的一些代码:

  string email = tbEmail.Text;
                string pass = tbPass.Text;
                bool remember = cbRemember.Checked;

                var res = (from user in ctx.users
                          where user.password == ctx.ConvertPassword(pass) 
                                                 && user.email == email
                          select user).FirstOrDefault();  // Remark : 0 = active, 1 = Inactive, 2 = Suspend, 3 = Unconfirmed

                if (res != null && res.email.ToLower() == email.ToLower())
                {
                    if (res.userstatus == 0 || res.userstatus == 3)
                    {
                        FormsAuthentication.SetAuthCookie(email, remember);
                        FormsAuthentication.RedirectFromLoginPage(email, remember);
                        var arr =  Request.Cookies.AllKeys;
                    }
                    else if (res.userstatus == (int)UserStatus.Inactive)
                    {
                        lblMessage.Text = "You have deleted your account, if you wish to restore it, please click ";
                        btRecover.Visible = true;
                    }
                    else if (res.userstatus == (int)UserStatus.Suspended)
                    {
                        lblMessage.Text = "Your account has been suspended, for more information, please contact our support";
                    }
                    else
                    {
                        lblMessage.Text = "Invalid username or password";
                    }
                }
                else
                {
                    lblMessage.Text = "Invalid username or password";
                }
我做错了什么

FormsAuthentication.SetAuthCookie(email, remember);
设置cookie。但也有

FormsAuthentication.RedirectFromLoginPage(email, remember);
这是一个更高级别的facade-不仅设置cookie,还将从登录页面重定向到重定向页面