Responds to the relationship between the Date attribute and the cookie expiration time in the http message,
When I tested. net today, I found an inexplicable problem: Cookies cannot be stored on the browser;
After careful comparison between successful and unsuccessful packets, I accidentally found that the Date is related to it, which is too unexpected. I never knew that the date in the packet should be considered when the cookie is saved.
Instead of setting the cookie's expiration date, the expiration time is based on date, rather than the client machine time on the browser side?
The following code verifies that the date time of a message is the start time of the cookie expiration time:
Header ('date: Mon, 17 Mar 2015 05:34:54 gmt'); // force modify the response time to the next day of the day. The normal time point should be the current
Setcookie ('A', rand (), time () + 3600); // The cookie expires in an hour.
This code will find that the cookie is not saved in the browser, because the browser thinks that the cookie has expired relative to the date, so it is not saved,
But according to my understanding, the start time of the cookie should be the time of the client?
Therefore, I do not know whether the date of the http attribute has such a role.
After my colleagues' efforts, I found this was a bug in iis. "After going up, I don't want to go down ";
From http://serverfault.com/questions/217343/date-header-returned-by-iis7-is-wrong
This appears to be a known issue and frequently found on virtual machine due to time sync feature. You may need to restart HTTP service on IIS6 to recover the behavior. Please refer to the content below:
Problem Description
W3SVC logs show incorrect time-stuck on the same time 2007-11-04 04:56:06
REPRO STEPS
- Changed the system time to a future time (e.g. 11th May 2020)
- Browsed any site-verified the log file created in the new date/time
- Changed the system time to be correct (today's date and time)
- Now, browsed any website and saw that the time on the log files is now stuck on 11th May 2020's time
RESOLUTION
- Net stop http
- Net start w3svc
OR
- Net stop http
- Net start http
- Iisreset
You must restart the http service whenever you change the date in the server.
Verified in the code and confirmed that this is by design and you need to follow the above steps to make IIS logging the correct time.
I hope the information helps.
Source: http://www.eggheadcafe.com/software/aspnet/31164622/wrong-date-and-time-in-iis-log-file.aspx