Cookie is a piece of information stored in the client computer/Browser which is limited to 4k in size.
Advatanges:-
There are 2 types of cookies
Persistent :- These are saved as a text file in file system of a clients computer ,Generally under TEMPORARY INTERNET FILES folder .
cookie Expires property must be set to create persistent cookie.
ex:- Remember me option.
Example to create persistent cookie
//create a cookie object
httpcookie cookie1= new httpcookie("userdetails");
//setting values to inside it
cookie1["username"]="naga";
cookie["usercolor"]="green";
cookie["expire"]=" 5 days";
//Adding expire time of cookies
cookie1.expires=DateTime.Now.ADD(5);
response.cookies.Add(cookie1);
Advatanges:-
- very simple to implement
- Browser automatically arranges cookies stored for multiple sites
- It stores cookie data in simple text format,so its not secure.
- cookie size limited to 4 kb
- No. of cookies stored by browser are limited to 20.some allow 300,when a new cookie comes old one will be discarded,
There are 2 types of cookies
- Non-persistent(Temporary) cookies
- Persistent(Permanent) cookies
Persistent :- These are saved as a text file in file system of a clients computer ,Generally under TEMPORARY INTERNET FILES folder .
cookie Expires property must be set to create persistent cookie.
ex:- Remember me option.
Example to create persistent cookie
//create a cookie object
httpcookie cookie1= new httpcookie("userdetails");
//setting values to inside it
cookie1["username"]="naga";
cookie["usercolor"]="green";
cookie["expire"]=" 5 days";
//Adding expire time of cookies
cookie1.expires=DateTime.Now.ADD(5);
response.cookies.Add(cookie1);
No comments:
Post a Comment