简体   繁体   中英

how do I set cookie expiration time in user local time?

I want a cookie to expire in 10 minutes precisely (just for the sake of argument).

If I use Expires = DateTime.Now.AddMinutes(30) and user is 3 hours behind me, cookie will expire as soon as it is received (is this correct?)

How do I set expiration so it is local to user?

Sure, I can use JavaScript to send that info together with the request, or use a JS-library of some sort to create cookie on the client side, or keep user profile and ask user for time zone, but I am looking a lazy-man solution.

Cookie到期日期将以GMT时间结束,因此您的代码将完全有效。

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