What is the difference between cookies and session?

Answer Posted / yogita mahajan

Cookies are some values saved in browsers for a particular website o publicly accessible
The purpose of cookies is to help websites to identify visitors and retrieve their saved preferences
Cookies are also used to facilitate auto login by persisting user id in a cookie save in user’s browser
Because cookies have been saved at client side, they do not create performance issues but may create security issues as they can be hacked from browser

Session variables are usually the most commonly used.
When a user visits a site, it’s sessions starts and when the user become idle or leave the site, the session ends.
Session variables should be used to save and retrive user specefic information required on multiple pages.
Session variables consumes server memory, so if your may have a huge amount visiters, use session very carefully and instead of put large values in it try to put IDs and references

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the system namespace?

467


what optimizations does the c# compiler perform when you use the /optimize+ compiler option?

588


What is winforms c#?

473


What is delegates in c#?

492


What is the difference between list and array in c#?

460






What is a collection class in c#?

470


What is wrong with the sample program below?

525


How do you implement thread synchronization (object.wait, notify,and criticalsection) in c#?

615


What are the Types of values mode can hold session state in web.config

543


Name the control which cannot be placed in mdi?

490


What is sql transaction in c#?

472


What is enum in c#?

526


What is verbatim string?

497


Which of these statements correctly declares a two-dimensional array in c#?

648


How do you name a variable in c#?

493