views:

151

answers:

1

I am using ASP.NET and VB.NET 2.0.....................................

This is my code i use when i create my 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

And this is my code i use on a Page Load Event to read that Cookie but i cant read it?

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

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

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

        End If

What am i doing wrong????

+5  A: 

Since you set your cookie as New HttpCookie("LoginInfo") , you should read it using

Request.Cookies("LoginInfo"), not

Request.Cookies("Email").

Ben Schwehn