Cookie expiration issue in asp.net

kNester

New Member
I am creating a cookie and getting a textbox value in it.I need to expire it and then has to print a message by checking that it has been expired or not.I am doing as following\[code\] HttpCookie usercookie = new HttpCookie("userinfo"); Response.Cookies["gettingusername"].Value = http://stackoverflow.com/questions/12600341/textbox_username.Text; Response.Cookies["gettingusername"].Expires = DateTime.Now; Response.Cookies.Add(usercookie); if (Request.Cookies["gettingusername"]!=null) { Response.Write("Cookie is Not Expired"); } else { Response.Write("Cookie Expired"); }\[/code\]But it always says:-\[code\]Cookie is Not Expired \[/code\]I am newbie for it.Please help.Thanks in advance.
 
Back
Top