Пример #1
0
        public bool Authenticate(string UserName, string Password)
        {
            Database data = new Database();

            SqlDataReader reader;

            SqlParameter[] prmtrs = {
                                        data.MakeInParam("@strUserName", SqlDbType.VarChar, 200, UserName),
                                        data.MakeInParam("@strPassword", SqlDbType.VarChar, 50, Password)
                                    };
            data.RunProc("sp_AuthenticateUser", prmtrs, out reader);
            if (reader.Read())
            {
                FormsAuthentication.SetAuthCookie(UserName, true);

                data.Close();
                data.Dispose();
                return true;
            }
            else
            {
                data.Close();
                data.Dispose();
                return false;
                // TODO:  USER IS NOT YET ACTIVATED
            }
        }