简体   繁体   中英

Cookie Expiration - How is chrome and edge miscalculating the cookie expiration date?

On a Microsoft Server 2016 - we are creating a Http response cookie that expires in 20 minutes.

cookie.Expires = DateTime.Now.AddMinutes(20);
HttpContext.Current.Response.Cookies.Add(cookie);

In the chrome browser (Version 108.0.5359.125 (Official Build) (64-bit)) the time is only 14 minutes ahead. 2022-12-22T19:48:26.705Z

Whereas firefox will have the correct time 22 DEC 2022 19:54:08 GMT

The time on the server is correct. When the cookie appears in the browser the time is incorrect. Not sure what all to check. One other fact was it was working just fine until Monday of this week. So I extended the expiration time to compensate.

Check your clocks on both server and client. Use a website like https://time.is/ for this purpose.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM