Exemplo n.º 1
0
        internal virtual void Init(string username, string password)
        {
            ISecurityUtility securityUtility = new SecurityUtility();
            var membershipProvider           = securityUtility.GetMembershipProvider();

            if (!membershipProvider.ValidateUser(username, password))
            {
                throw new ApplicationException(string.Format("Failed to init Session Object. Invalid username or password. Username: {0}. Password {1}", username, password));
            }

            var user = SecurityUtility.GetUserByUsername(username);

            if (user == null)
            {
                throw new ApplicationException(string.Format("Cannot retrieve user for username {0}.", username));
            }

            Init(user);
        }