示例#1
0
        //用户登录验证
        public JsonResult LoginValidate(string uid, string pwd)
        {
            bool IsSuccess = false;

            try
            {
                UsersModel    user   = new UsersModel();
                UsersProvider userdb = new UsersProvider();
                user = userdb.CheckUserLogin(uid, pwd);
                if (!string.IsNullOrEmpty(user.UserID))
                {
                    IsSuccess      = true;
                    Session[USRID] = user.UserID;
                    FormsAuthentication.SetAuthCookie(string.Format("{0},{1},{2}", user.UserName, "", ""), false);
                }
            }
            catch { }

            return(Json(new { IsSuccess = IsSuccess }, "text/html", JsonRequestBehavior.AllowGet));
        }