当我想读取我的cookie时出现问题 - 使用ASP.NET

Eti*_*nne 0 c# vb.net asp.net cookies

我正在使用ASP.NET和VB.NET 2.0 .....................................

这是我在创建Cookie时使用的代码

If dlgLogin.RememberMeSet = True Then

        Dim RateCookie As New HttpCookie("LoginInfo")

        RateCookie.Values("Email") = dlgLogin.UserName
        RateCookie.Values("Password") = dlgLogin.Password
        RateCookie.Expires = DateTime.Now.AddDays(100)
        Response.Cookies.Add(RateCookie)

    End If
Run Code Online (Sandbox Code Playgroud)

这是我在页面加载事件上使用的代码来读取Cookie但我无法读取它?

 If Not Request.Cookies("Email") Is Nothing Then

            Dim RateCookie As HttpCookie = Request.Cookies("Email")

            Session("myEmailSession") = Server.HtmlEncode(RateCookie.Value)

        End If
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么????

Ben*_*ehn 6

由于您将cookie设置为 New HttpCookie("LoginInfo") ,您应该使用它来阅读它

Request.Cookies("LoginInfo")不是

Request.Cookies("Email").