Last active
August 29, 2015 14:26
-
-
Save ta264/7822b1424f72e5b4c961 to your computer and use it in GitHub Desktop.
Cookie expiry test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tom@htpc:~/repos/tlstest$ mono utc2.exe | |
Expires: 02/08/2015 15:19:50 (expired? True) | |
Expires: 02/08/2015 16:19:50 (expired? False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Net; | |
public class UtcTest { | |
public static void Main (string[] args) { | |
TestExpired(DateTime.UtcNow.AddHours(1)); | |
TestExpired(DateTime.Now.AddHours(1)); | |
return; | |
} | |
private static void TestExpired(DateTime expiry) { | |
var cookie = new Cookie("my", "test", "/", "httpbin.eu"); | |
cookie.Expires = expiry; | |
Console.WriteLine("Expires: {0} (expired? {1})", | |
cookie.Expires, cookie.Expired); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment