Merge pull request #2735 from xmcclure/early-lookup-addr
[mono.git] / mcs / class / System.Web / System.Web.Security / FormsAuthentication.cs
index ab273d4970bb7a4cd641996ed585173d01bd1379..491d74f6c4d49884b7a72f0fe70695f6c068871e 100644 (file)
@@ -213,22 +213,19 @@ namespace System.Web.Security
 
                        DateTime now = DateTime.Now;
                        DateTime then;
-                       if (createPersistentCookie)
-                               then = now.AddYears (50);
-                       else
-                               then = now.AddMinutes (timeout);
+                       if (createPersistentCookie)
+                               then = now.AddMinutes(timeout);
+                       else
+                               then = DateTime.MinValue;
 
                        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket (1,
                                                                                          userName,
                                                                                          now,
-                                                                                         then,
+                                              createPersistentCookie?then:now.AddYears (50),
                                                                                          createPersistentCookie,
                                                                                          String.Empty,
                                                                                          cookiePath);
 
-                       if (!createPersistentCookie)
-                               then = DateTime.MinValue;
-
                        HttpCookie cookie = new HttpCookie (cookieName, Encrypt (ticket), strCookiePath, then);
                        if (requireSSL)
                                cookie.Secure = true;