I have an ASP.NET application running on a server in California. The server's current time is:
Bob is connected to my server. Bob is in Texas. His current time is:
My application creates a cookie and set its expiration date.
var name = "MyName";
var value = "MyValue"
var hoursToLive = 24;
var myCookie = new HttpCookie(name )
{
Value = value,
Expires = DateTime.Now.AddHours(hoursToLive)
};
Will the cookie expire in 24 hours, or will it expire in 22 hours due to the time difference between Bob and the server? I know that DateTime.Now uses the server's local time, but I am unclear as to how browsers decide that a cookie is expired (specifically, what time zone is used to determine expiration).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With