public ActionResult Login(string account, string password, string dbtype) { var msg = string.Empty; var success = false; try { if (!string.IsNullOrEmpty(dbtype)) { Session.Timeout = 1440; Session[SessionKey.SESSION_KEY_DBINFO] = dbtype; } else { return(RedirectToAction("LoginPage")); } var result = HomeBusiness.Login(account, password); //写入cookie string key = CommonHelper.Md5(CookieKey.COOKIE_KEY_USERINFO); string data = JsonHelper.Serializer <UserLoginInfo>(result); CookieHelper.SetCookie( key, CommonHelper.DesEncrypt(data, HomeContent.CookieKeyEncrypt), DateTime.Now.AddDays(1).Date, ServerInfo.GetTopDomain); //写入权限信息 var list = JurisdictionBusiness.GetAllRoleCodeByUserid(LoginUser); string roleKey = CommonHelper.Md5(CookieKey.COOKIE_KEY_ROLEINFO); string roleData = JsonHelper.Serializer <List <string> >(list); CookieHelper.SetCookie(roleKey, CommonHelper.DesEncrypt(roleData, CookieKey.COOKIE_KEY_ENCRYPT), DateTime.Now.AddDays(1).Date, ServerInfo.GetTopDomain); success = true; } catch (Exception ex) { msg = ex.Message; } return(Json(new { Success = success, Message = msg })); }