Monday, 2 November 2009

SET THE COOKIE

SET THE COOKIE

Response.Cookies["test"].Value = TextBox1 .Text ;

Response.Cookies["test"].Expires = DateTime.Now.AddYears(30);

After that

How to Expried Cookie

Response.Cookies["test"].Expires = DateTime.Now.AddYears(-30);

How to Write/Read cookie

/////////check to see if cookie presented//////////

if (Request.Cookies["test"] == null)

{

TextBox2.Text = "No cookie found";

}

Else

{

TextBox2 .Text = Request.Cookies["test"].Value;

}

/////////END check to see if cookipresented//////////