コード例 #1
0
        void Page_Load(object sender, EventArgs args)
        {
            // If a user did use the auto-login feature, we can use the login cooky and do a login if the session was timeouted.
            if (!Page.User.Identity.IsAuthenticated)
            {
                HttpCookie cookie = (HttpCookie)Request.Cookies["PortalUser"];
                if (cookie != null)
                {
                    try
                    {
                        if (UserManagement.Login(Crypto.Decrypt(cookie.Values["AC"]), Crypto.Decrypt(cookie.Values["PW"])))
                        {
                            Response.Redirect(Request.RawUrl);
                        }
                    }
                    catch (Exception) { }
                }
            }

            if (Page.User.Identity.IsAuthenticated)
            {
                CommonUtilities.AddLifeguard(this.Page);
            }

            LoadCustomHeader();
        }
コード例 #2
0
 private void ApplyAutoLogin()
 {
     // If a user did use the auto-login feature, we can use the login cooky and do a login.
     if (!Page.User.Identity.IsAuthenticated)
     {
         HttpCookie cookie = (HttpCookie)Request.Cookies["PortalUser"];
         if (cookie != null)
         {
             try
             {
                 if (UserManagement.Login(Crypto.Decrypt(cookie.Values["AC"]), Crypto.Decrypt(cookie.Values["PW"])))
                 {
                     Response.Redirect(Request.RawUrl, true);
                 }
             }
             catch (Exception) { }
         }
     }
 }