Exemple #1
0
 public static User GetActiveUser()
 {
 if(HttpContext.Current.User.Identity.IsAuthenticated == false)
     {
         return new User() { IsLoggedIn = false };
     }
     else
     {
         MembershipService service = new MembershipService();
         User returnValue = service.GetUser(HttpContext.Current.User.Identity.Name);
         returnValue.IsLoggedIn = true;
         return returnValue;
     }
 }
Exemple #2
0
        public static User Login(string username, string password)
        {
            MembershipService service = new MembershipService();
            User returnValue = service.Login(username, password);
            if (returnValue.IsLoggedIn)
            {
                FormsAuthentication.SetAuthCookie(returnValue.Name, true);
                returnValue.IsLoggedIn = true;
            }
            else
            {
                returnValue.IsLoggedIn = false;
            }

            return returnValue;
        }
 public MembershipServiceTest()
 {
     this.service = new MembershipService();
 }