Cookies
A cookie is a small piece of text file stored on user's computer in the form of name-value pair.
Cookies are used by websites to keep track of visitors e.g. to keep user information like username etc. If any web application using cookies, Server send cookies and client browser will store it. The browser then returns the cookie to the server at the next time the page is requested. The most common example of using a cookie is to store User information, User preferences, Password Remember Option etc.
Type of Cookies
Persistent Cookies -
A cookie with no expiry time. Resides in your local file and can be accessed by web servers until they are deleted is called Persistent Cookies. Means these cookies are Permanent .
For Example :
Non Persistent -
A cookie with expiry time. Gets flushed when your browser is closed (Available only when browser is running) is called Non Persistent Cookie.
Points about Cookies-
1. Cookies are domain specific i.e. a domain cannot read or write to a cookie created by another domain. This is done by the browser for security purpose.
2. Cookies are browser specific. Each browser stores the cookies in a different location. The cookies are browser specific and so a cookie created in one browser(e.g in Google Chrome) will not be accessed by another browser(Internet Explorer/Firefox)
3. Most of the browsers store cookies in text files in clear text. So it’s not secure at all and no sensitive information should be
stored in cookies.
4. Most of the browsers have restrictions on the length of the text stored in cookies. It is 4096(4kb) in general but could vary from browser to browser.
5. Some browsers limit the number of cookies stored by each domain(20 cookies). If the limit is exceeded, the new cookies will
replace the old cookies
6. Cookies can be disabled by the user using the browser properties. So unless you have control over the cookie settings of the users
7. Cookie names are case-sensitive. E.g. UName is different than uname. User can delete a cookie.
A cookie is a small piece of text file stored on user's computer in the form of name-value pair.
Cookies are used by websites to keep track of visitors e.g. to keep user information like username etc. If any web application using cookies, Server send cookies and client browser will store it. The browser then returns the cookie to the server at the next time the page is requested. The most common example of using a cookie is to store User information, User preferences, Password Remember Option etc.
Type of Cookies
Persistent Cookies -
A cookie with no expiry time. Resides in your local file and can be accessed by web servers until they are deleted is called Persistent Cookies. Means these cookies are Permanent .
For Example :
Response.Cookies["Name_Your_Cookie"].Value = "This is a Persistent Cookie Example";
Response.Cookies["Name_Your_Cookie"].Expires = DateTime.Now.AddSeconds(10);
|
Non Persistent -
A cookie with expiry time. Gets flushed when your browser is closed (Available only when browser is running) is called Non Persistent Cookie.
Response.Cookies["Name_Your_Cookie"].Value = "This is A Non Persistent Cookie."; |
Points about Cookies-
1. Cookies are domain specific i.e. a domain cannot read or write to a cookie created by another domain. This is done by the browser for security purpose.
2. Cookies are browser specific. Each browser stores the cookies in a different location. The cookies are browser specific and so a cookie created in one browser(e.g in Google Chrome) will not be accessed by another browser(Internet Explorer/Firefox)
3. Most of the browsers store cookies in text files in clear text. So it’s not secure at all and no sensitive information should be
stored in cookies.
4. Most of the browsers have restrictions on the length of the text stored in cookies. It is 4096(4kb) in general but could vary from browser to browser.
5. Some browsers limit the number of cookies stored by each domain(20 cookies). If the limit is exceeded, the new cookies will
replace the old cookies
6. Cookies can be disabled by the user using the browser properties. So unless you have control over the cookie settings of the users
7. Cookie names are case-sensitive. E.g. UName is different than uname. User can delete a cookie.
0 comments:
Post a Comment