Create Cookie:
HttpCookie login=new HttpCookie ("userdata");
login["username"] = username_txb.Text;
Response.Cookies.Add(login );
Request cookie:
HttpCookie login = Request.Cookies["userdata"];
string username = login["username"];
username_lbl.Text = "Welcome " + username;
Delete cookie using expire date:
HttpCookie myCookie = new HttpCookie("userdata");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);
HttpCookie login=new HttpCookie ("userdata");
login["username"] = username_txb.Text;
Response.Cookies.Add(login );
Request cookie:
HttpCookie login = Request.Cookies["userdata"];
string username = login["username"];
username_lbl.Text = "Welcome " + username;
Delete cookie using expire date:
HttpCookie myCookie = new HttpCookie("userdata");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);
No comments:
Post a Comment