Example #1
0
        public int ValidateUser(string username, string password)
        {
            int count = CheckUser(username, password);

            if (count == 1)
            {
                FormsAuthentication.SetAuthCookie(username, false);
                string url  = FormsAuthentication.GetRedirectUrl(username, false);
                User   user = db.Users.Where(m => m.Username == username).Single();
                db.LastLoginUpdate(username);
                Session["Name"] = user.FirstName + " " + user.LastName;
                return(1);
            }
            else
            {
                return(0);
            }
        }