Remember Me cookie in asp.net vb.net

Hi Experts,

In my project's log in screen I want to create a "Remember Me" cookie when the "Remember Me" check box is checked.

Thanks.
RadhaKrishnaKiJayaAsked:
Who is Participating?
 
Paul MacDonaldDirector, Information SystemsCommented:
You've verified the cookie is not being written?  Or is the cookie being written, but not read?

Here's an alternate way to write the cookie:
Dim myCookie As HttpCookie = New HttpCookie("UserSettings")
myCookie("Font") = "Arial"
myCookie("Color") = "Blue"
myCookie.Expires = Now.AddDays(1)
Response.Cookies.Add(myCookie)

Reading the cookie should work the same way.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
How to: Write a Cookie (MSDN article)
Response.Cookies("UserSettings")("Font") = "Arial"
Response.Cookies("UserSettings")("Color") = "Blue"
Response.Cookies("UserSettings").Expires = DateTime.Now.AddDays(1)

How to: Read a Cookie (MSDN article)
If (Request.Cookies("UserSettings") IsNot Nothing) Then
    Dim userSettings As String
    If (Request.Cookies("UserSettings")("Font") IsNot Nothing) Then
        userSettings = Request.Cookies("UserSettings")("Font")
    End If
End If
0
 
RadhaKrishnaKiJayaAuthor Commented:
Thank you for your reply. I tried but it is not working.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Paul MacDonaldDirector, Information SystemsCommented:
What, specifically, is not working?
0
 
RadhaKrishnaKiJayaAuthor Commented:
It is not saving the cookie. When I reload the program next time, it does not remember the ID and Password.

Thanks.
0
 
RadhaKrishnaKiJayaAuthor Commented:
Thank you for your reply. I will try it and let you know.
0
 
RadhaKrishnaKiJayaAuthor Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.