How to deal with arrays of data in cookies

Posted by peter on Stack Overflow See other posts from Stack Overflow or by peter
Published on 2010-05-03T22:23:48Z Indexed on 2010/05/03 22:28 UTC
Read the original article Hit count: 557

Filed under:
|
|

Hi all,

I want to store data in a cookie and I am not exactly sure how I will go about it.

The data is the UserName, and Password values for the users that are logging into a website, e.g. sometime like this

  UserName = bob, Password=Passw0rd1
  UserName = harry, Password=BLANK
  UserName = george, Password=R0jjd6s

What this means is that bob and george logged into the site and chose to have their password remembered, but harry chose for his password not to be remembered.

So on the login dialog a dropdown will be present with all the usernames in it 'bob', 'harry', 'george'. If they select the username bob the password will automatically be filled in, etc.

So how does that information need to be stored in the cookie? Like it is above, or does it have to be,

  UserName1 = bob, Password1=Passw0rd1
  UserName2 = harry, Password2=BLANK
  UserName3 = george, Password3=R0jjd6s

Are the username and password values actually stored in the same cookie, or is each piece of data separate? Any information would be good.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#