Cookies
Cookies
Types of Cookies
1. Persistence Cookie
These types of cookies are permanently stored on user hard drive.
Cookies which have an expiry date time are called persistence cookies. These types of
cookies stored user hard drive permanently till the date time we set.
Here, we create cookie with name parameter and assign textbox values to name cookie
and also set expiry time 1 minute. The cookie destroyed after 1 minute.
On retrieve cookie button checks if cookie value not null then display cookie value in
result, but after 1 minute the cookie expires, after 1 minute cookie value will be null and
result will be “No cookie found”.
}
protected void Button2_Click(object sender, EventArgs e)
{
if (Request.Cookies["name"] == null)
{
TextBox2.Text = "No cookie found";
}
else
{
TextBox2.Text = Request.Cookies["name"].Value;
}