I’m wondering, are there any guidelines or best practices on when to use sessions and cookies?
What should and what should’nt be stored in them? Thanks!
I’m wondering, are there any guidelines or best practices on when to use sessions
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
These documents are a good read on security problems with session cookies, and how to get around them.
In summary, you keep a secret key on the server. With this key you can calculate a secure hash over the secret key, a time stamp, and any data you want in the cookie. You include the secure hash, the time stamp and the data in the cookie.
When you receive a request you can validate that you get the signature expected. So nobody have tampered with the cookie contents.