Should I use DateTime.Now or DateTime.UtcNow in HttpCookie.Expires and HttpCachePolicy.SetExpires?
问题 Should I use DateTime.Now or DateTime.UtcNow in HttpCookie.Expires and HttpCachePolicy.SetExpires ? Cookies are sending 'GMT' time, but I don't know what happen if I send DateTime.Now.AddDays(3) if I would be in GMT+5. Same with Expires HTTP header (sec 14.21). What should I use? 回答1: It doesn't matter in this case. Internally, the first thing .SetExpires does is convert your supplied datetime into UTC, before setting it on the cookie. Bear in mind, as long as your datetime consumer uses the