コード例 #1
0
        public bool Login(string userName, string password, bool createPersistentCookie)
        {
            ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, true);

            //


            if (Membership.ValidateUser(userName, password))
            {
                FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
                return(true);
            }

            return(false);
        }
コード例 #2
0
 public bool IsLoggedIn()
 {
     ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false);
     return(HttpContext.Current.Request.IsAuthenticated);
 }
コード例 #3
0
 public void Logout()
 {
     ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false);
     FormsAuthentication.SignOut();
 }