Time Zones and Cookies Expiration-VBForums
Results 1 to 1 of 1

Thread: Time Zones and Cookies Expiration

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    36

    Question Time Zones and Cookies Expiration

    As far as I understand, browsers use UTC to check cookies for expiration. That allows to avoid the following situation. Suppose, a server wants to set a cookie with a lifetime of 2 hours. The server uses its own local time, but its in a different time zone 3 hours ahead w.r.t browser. Then the new cookie will be expired upon arrival.

    So far, so good.

    The MSDN reference page for HttpCookie.Expires property doesn't say anything about time zones and provides this example:

    Code:
    OatmealCookie.Expires = DateTime.Now.AddMinutes(10.0);
    I was expecting something along the lines of

    Code:
    OatmealCookie.Expires = DateTime.Now.ToUniversalTime().AddMinutes(10.0);
    Does the framework automatically convert to UTC ?

    Any suggestion, insight or reference is really appreciated!

    p.s. Found this related thread: How do I set cookie expiration time in user local time?
    Last edited by kender; Feb 21st, 2015 at 09:44 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.