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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Paul MacDonaldDirector, Information SystemsCommented:
What, specifically, is not working?
0
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RadhaKrishnaKiJayaAuthor Commented:
Thank you for your reply. I will try it and let you know.
0
RadhaKrishnaKiJayaAuthor Commented:
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.