G
Guest
Below is the code to save the cookie and set the expiry date of the cooki
Response.Cookies["demo"].Value ="Hello"
DateTime dt = DateTime.Now
TimeSpan ts = new TimeSpan(0,0,10,0)
Response.Cookies ["demo"].Expires = dt.Add(ts);
Below is the code to retrieve the stored cookie
if (!Page.IsPostBack)
HttpCookie dcookie = Request.Cookies["demo"]
if (dcookie != null)
urlevel.Text = dcookie.Values["level"]
urname.Text = dcookie.Values["user"];
daysx.Text = Convert.ToString(Request.Cookies["demo"].Expires)
els
Response.Redirect ("haha.htm")
When I display the Response.Cookies ["demo"].Expires = dt.Add(ts); it returns the current date + 10 minute
But the days.Text returns 01/01/0001. Why? Please help Thanks
Ra
Response.Cookies["demo"].Value ="Hello"
DateTime dt = DateTime.Now
TimeSpan ts = new TimeSpan(0,0,10,0)
Response.Cookies ["demo"].Expires = dt.Add(ts);
Below is the code to retrieve the stored cookie
if (!Page.IsPostBack)
HttpCookie dcookie = Request.Cookies["demo"]
if (dcookie != null)
urlevel.Text = dcookie.Values["level"]
urname.Text = dcookie.Values["user"];
daysx.Text = Convert.ToString(Request.Cookies["demo"].Expires)
els
Response.Redirect ("haha.htm")
When I display the Response.Cookies ["demo"].Expires = dt.Add(ts); it returns the current date + 10 minute
But the days.Text returns 01/01/0001. Why? Please help Thanks
Ra