public static void RemoveLoginSession() { var session = HttpContext.Current.Session; if (session[ConstClass.SessionKeyMLoginUser] != null) { var id = session[ConstClass.SessionKeyMLoginUser].As(0); RedisCacheHelper.Remove(GetLoginUserRedisKey(id)); session[ConstClass.SessionKeyMLoginUser] = null; CookieHelper.ClearCookie(ConstClass.LoginUserCookieKey); } }
public ActionResult Logout() { CookieHelper.ClearCookie("username"); CookieHelper.ClearCookie("password"); CookieHelper.ClearCookie("remember"); CookieHelper.ClearCookie("tockenid"); ComResult com = new ComResult(); com.State = 1; com.URL = "/login/login"; return(Json(com)); }
/// <summary> /// 判断用户是否被强迫离线[true是;false否] /// </summary> public bool IsOffline(Page page) { try { //获取当前用户Id var userinfoId = GetManagerId(); //判断当前用户是否已经被系统清除 if (userinfoId == 0) { //通知用户 FineUI.Alert.Show("您太久没有操作已退出系统,请重新登录!", "检测通知", MessageBoxIcon.Information, "window.location.href='/WebManage/Login.aspx';"); return(true); } else { //判断在线用户的Md5与当前用户存储的Md5是否一致 if (GenerateMd5() != CookieHelper.GetCookieValue(OnlineUsersTable.Md5)) { //添加用户下线记录 LoginLogBll.GetInstence().Save(userinfoId, "用户【{0}】的账号已经在另一处登录,本次登陆下线!在线时间【{1}】"); //清除在线表里与当前用户同名的记录 Delete(null, x => x.Id == userinfoId); //清空Session SessionHelper.RemoveSession(OnlineUsersTable.UserHashKey); SessionHelper.RemoveSession(OnlineUsersTable.Md5); SessionHelper.RemoveSession(PositionTable.PagePower); SessionHelper.RemoveSession(PositionTable.ControlPower); //删除Cookies CookieHelper.ClearCookie(OnlineUsersTable.UserHashKey); CookieHelper.ClearCookie(OnlineUsersTable.Md5); CommonBll.WriteLog("当前帐号已经下线,用户Id【" + userinfoId + "】"); //通知用户 FineUI.Alert.Show("您的账号已经在另一处登录,当前账号已经下线!", "检测通知", MessageBoxIcon.Information, "window.location.href='/WebManage/Login.aspx';"); return(true); } } return(false); } catch (Exception ex) { CommonBll.WriteLog("Logic.Systems.Manager.CheckIsOffline出现异常", ex); FineUI.Alert.Show("系统已经开始更新维护,请稍后重新登录!", "检测通知", MessageBoxIcon.Information, "window.location.href='/WebManage/Login.aspx';"); return(true); } }
public ActionResult LoginReturnUrl(string url) { if (CookieHelper.IsLogin) { var member = MemberService.Find(CookieHelper.MemberID); CookieHelper.ClearCookie(); MemberService.Login(member.Email, CheckHelper.StrToMd5(member.Password)); return(Redirect(url)); } else { return(RedirectToAction("index", new { ReturnUrl = url })); } }
/// <summary> /// 确认订单页面 /// </summary> /// <returns></returns> public ActionResult payment(string orderid) { LogHelper.Error("回调311111111111111111111111"); #region 如果页面无参数传入,微信会把Payment作为一个目录处理,这里增加个判断,如果无参数,则随便加个参数 if (Request.QueryString.Count == 0) { return(RedirectToAction("/mobile/mobilecenter/bill", new { q = "t", orderid = orderid })); } #endregion List <string> orderList = new List <string>(); if (string.IsNullOrEmpty(orderid)) { //throw new Exception("获取订单id失败"); //来自购物车 string cartlist = CookieHelper.GetCookieValue("cart"); if (string.IsNullOrEmpty(cartlist)) { return(RedirectToAction("Bill")); } //获取下单总金额 cartlist = SecurityHelper.UrlDecode(cartlist); Dictionary <int, int> prodList = cartlist.JsonDeserializer <Dictionary <int, int> >(); //生成订单 Member_Info curUser = User_Shop.GetMember_Info(); DB.ShopOrder.GenerateOrder(curUser, 0, null); //3.清空cookie CookieHelper.ClearCookie("cart"); CookieHelper.ClearCookie("total"); return(RedirectToAction("Bill"));//跳转待付款 } orderList.Add(orderid); ShopOrder model = DB.ShopOrder.FindEntity(orderid); if (model == null) { throw new Exception("获取订单信息失败"); } if (model.TraceNo.IsNull()) { model.TraceNo = model.GUID; DB.ShopOrder.Update(model); } CookieHelper.SetCookie("traceno", model.TraceNo, 1); CookieHelper.SetCookie("orderlist", orderList.ToJsonString(), null); return(View(model)); }
public ActionResult Loginout() { var loginProvider = RequestHelper.GetSystemConfigByKey("LoginProvider"); if (loginProvider == "Cookie") { CookieHelper.ClearCookie(SysConstant.SEESIONUSERKEY); } else { SessionHelper.ClearSession(); } return(View("Index")); }
private string AutoLogin(string telNo, TdUserInfo model) { if (model == null) { return("没有找到用户信息"); } if (string.IsNullOrEmpty(telNo.Trim())) { return("手机号不能为空"); } if ((model.uStatus ?? 0) == 1) { WebUserAuth.SignIn(model.Id.ToString()); //登录时判断超级会员是否过期 model.Level = BusinessDll.Users.JudgeUserLevel(model.Level.Value, model.LevelEndDate); model.LastLoginDate = DateTime.Now; string userIP = Tool.WebFormHandler.GetIP(); TuanDai.InfoSystem.Model.LoginLog loginLogEntity = new TuanDai.InfoSystem.Model.LoginLog(); loginLogEntity.Id = Guid.NewGuid().ToString(); loginLogEntity.UserId = model.Id.ToString(); loginLogEntity.IpAddress = userIP; loginLogEntity.LoginDate = model.LastLoginDate; loginLogEntity.DeviceType = "WeiXin"; loginLogEntity.DeviceName = Request["app"].ToLower() + "自动登录"; //TuanDai.InfoSystem.WcfClient.LoginLogService logApi = new TuanDai.InfoSystem.WcfClient.LoginLogService(); //logApi.AddLoginLog(loginLogEntity); TuanDai.WXApiWeb.SysLogHelper.AddLoginLog(loginLogEntity); UserBLL userbll = new UserBLL(); //保存用户最后登录时间 userbll.WXUpdateUserLastLoginDate(model); //记录注册IP //BusinessDll.RegisterIp.WriteLoginHandler(model.Id); userbll.AsyncLoginEnd(model.Id, 1, userIP, "", "", model.ThirdPartyId, model.ThirdPartyType); //登录成功后移除第三方写的Cookie CookieHelper.ClearCookie("ThirdLoginUserInfo"); CookieHelper.ClearCookie("WXLoginType"); return(string.Empty); } else { return("登录失败,用户状态不能登录"); } }
private void Login() { string userName = Request.Form["user"]; string psw = Request.Form["psw"]; string remerberMe = Request.Form["remerberMe"]; UserInfo user = new UserInfo(); user.userName = userName; user.passWord = psw; user.mobilePhone = userName; string token = ""; string value = UserInfoManage.Login(ref user, ref token); CookieHelper cookie = new CookieHelper(Context); if (value == "登录成功") { Response.Write("T"); Session["user"] = user; List <DepartmentPost> dpList = UserInfoManage.GetDepartmentPostList(user); Session["DepartmentPostList"] = dpList; //把用户名存入cookie cookie.ClearCookie("RememberMe"); cookie.SetCookie("RememberMe", user.userName, DateTime.Now.AddDays(7)); if (remerberMe == "true")//把token存入cookie { cookie.ClearCookie("LoginToken"); cookie.SetCookie("LoginToken", token, DateTime.Now.AddDays(7)); } } else { Response.Write(value); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 初始化用户Session变量 //清空Session SessionHelper.RemoveSession(PositionTable.PagePower); SessionHelper.RemoveSession(PositionTable.ControlPower); SessionHelper.RemoveSession(OnlineUsersTable.UserHashKey); SessionHelper.RemoveSession(OnlineUsersTable.Md5); //删除Cookies CookieHelper.ClearCookie(OnlineUsersTable.UserHashKey); CookieHelper.ClearCookie(OnlineUsersTable.Md5); #endregion } }
public ActionResult Index(string VCode, string UserName, string Password) { VCode = VCode.ToLower().Trim(); string name = "cactus_"; VCode = name + VCode; //最后判断来源 if (CryptoHelper.MD5Encrypt(VCode) == CookieHelper.GetCookieValue("code")) { User u = userService.CheckLogin(UserName.Trim(), Password.Trim()); if (u == null) { return(Json(new ResultModel { msg = "用户不存在", pass = false })); } else { string sid = "cactus_" + StringHelper.GetGuidString(); CookieHelper.SetCookie("Admin", sid); //更新用户登录信息 u.LastLoginTime = DateTime.Now; u.LastLoginIp = WebHelper.GetClientIPAddress(); userService.Update(u); //加入缓存 base.cacheService.Add(Constant.CacheKey.LoginAdminInfoCacheKey + "_" + sid, new HTools.CacheObj() { value = u, AbsoluteExpiration = new TimeSpan(1, 0, 0, 0) }); //清除验证码code CookieHelper.ClearCookie("code"); base.logService.WriteLog(u.User_Id, "登录系统"); return(Json(new ResultModel { msg = "登陆成功", pass = true })); } } else { return(Json(new ResultModel { msg = "验证码错误", pass = false })); } }
public JsonResult Connect(ConnectionSettingsModel connectionSettings) { try { InstallationComponentsModel installedComponents = null; InstallationComponentsModel selectedComponents = null; InstallationProgressModel installationProgress = null; if (connectionSettings != null) { installedComponents = SshHelper.Connect(UserId, connectionSettings); installationProgress = CacheHelper.GetInstallationProgress(UserId); selectedComponents = CacheHelper.GetSelectedComponents(UserId); CacheHelper.SetConnectionSettings(UserId, connectionSettings); CacheHelper.SetInstalledComponents(UserId, installedComponents); } else { CookieHelper.ClearCookie(); CacheHelper.ClearCache(UserId); } return(Json(new { success = true, message = string.Empty, connectionSettings = GetJsonString(connectionSettings), installedComponents = GetJsonString(installedComponents), installationProgress = GetJsonString(installationProgress), selectedComponents = GetJsonString(selectedComponents) })); } catch (Exception ex) { LogManager.GetLogger("ASC").Error(ex.Message, ex); return(Json(new { success = false, message = ex.Message, errorCode = GetErrorCode(ex.Message) })); } }
public ActionResult LoginCheck(string username, string password, string ValidCode, bool remember) { //识别是否主库登录 var ismainlogin = false;//false从库登录true主库登录 CookieHelper.SetCookie("ismainlogin", ismainlogin.ToString()); LCWebApp.Controllers.Base.ComResult com = new LCWebApp.Controllers.Base.ComResult(); //1.判断验证码 if (ValidCode.ToLower() != SessionHelper.Get("RandomCode").ToString().ToLower()) { com.Msg = "验证码错误!"; com.State = 0; return(Json(com)); } //2.验证账号密码 var result = _service.VerifyUserLogin(1, username, EncodeHepler.GetMD5(password), false); //3.判断用户是否记住密码功能 if (result.State == 1 && remember) { CookieHelper.SetCookie("username", username); CookieHelper.SetCookie("password", password); CookieHelper.SetCookie("remember", remember.ToString()); } else { CookieHelper.ClearCookie("username"); CookieHelper.ClearCookie("password"); CookieHelper.ClearCookie("remember"); SessionHelper.Delete("RandomCode"); } if (result.State == 1) { CookieHelper.SetCookie("username", username); result.URL = "/Main/index"; SessionHelper.Delete("RandomCode"); return(Json(result)); } else { return(Json(result)); } }
public ActionResult Index(string id) { var enterprise = !string.IsNullOrEmpty(id) && id.ToLowerInvariant() == "enterprise"; ConnectionSettingsModel connectionSettings = null; InstallationComponentsModel availableComponents = CacheHelper.GetAvailableComponents(enterprise); InstallationComponentsModel installedComponents = null; InstallationComponentsModel selectedComponents = null; InstallationProgressModel installationProgress = null; OsInfo osInfo = null; if (!string.IsNullOrEmpty(UserId)) { connectionSettings = CacheHelper.GetConnectionSettings(UserId); if (connectionSettings != null) { installedComponents = CacheHelper.GetInstalledComponents(UserId); selectedComponents = CacheHelper.GetSelectedComponents(UserId); installationProgress = CacheHelper.GetInstallationProgress(UserId); osInfo = CacheHelper.GetOsInfo(UserId); } else { CookieHelper.ClearCookie(); CacheHelper.ClearUserCache(UserId); } } ViewBag.ConnectionSettings = GetJsonString(connectionSettings); ViewBag.AvailableComponents = GetJsonString(availableComponents); ViewBag.InstalledComponents = GetJsonString(installedComponents); ViewBag.SelectedComponents = GetJsonString(selectedComponents); ViewBag.InstallationProgress = GetJsonString(installationProgress); ViewBag.OsInfo = GetJsonString(osInfo); ViewBag.Enterprise = enterprise; if (!string.IsNullOrEmpty(Settings.CacheKey) && Request.Params["cache"] == Settings.CacheKey) { CacheHelper.ClearCache(); } return(View()); }
public ActionResult GxfaWxIndex(string openid) { /////获取openid if (openid == null) { ////openid = "oXx_Mw7JSzz218WpGTprNfSaHC7k";//鹏伟峰 openid = "oXx_Mw-hx0yNF3wIELsf_RP6cJoA";//我的 string user_id = getuserinfodal.GetUserID(openid); string membership = getuserinfodal.GetMemberType(user_id); string username = getuserinfodal.GetUserName(user_id, membership); CookieHelper.ClearCookie("openid"); CookieHelper.SetCookie("openid", openid); Session["user_id"] = user_id; Session["user_name"] = username; string url1 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46 string url2 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1; Session["RegisterUrl"] = url2; Session["url"] = url2; string url3 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46 string url4 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/Register/GxLoginRegisterPersonal/?openid= " + openid + "&url1=" + url3; Session["FinishRegisterUrl"] = url4; ViewBag.openid = openid; } else { ViewBag.openid = openid; CookieHelper.ClearCookie("openid"); CookieHelper.SetCookie("openid", openid); string url1 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46 string url2 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1; Session["url"] = url2; string user_id = getuserinfodal.GetUserID(openid); if (user_id == "none") { } Session["user_id"] = user_id; Session["user_name"] = user_id; //Session["user_id"] = "70"; //Session["user_name"] = "70"; } return(View()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //生成验证码 imgCaptcha.ImageUrl = "Application/Vcode.ashx?t=" + DateTime.Now.Ticks; #region 初始化用户Session变量 //清空Session SessionHelper.RemoveSession(PositionTable.PagePower); SessionHelper.RemoveSession(PositionTable.ControlPower); SessionHelper.RemoveSession(OnlineUsersTable.UserHashKey); SessionHelper.RemoveSession(OnlineUsersTable.Md5); //删除Cookies CookieHelper.ClearCookie(OnlineUsersTable.UserHashKey); CookieHelper.ClearCookie(OnlineUsersTable.Md5); #endregion } }
public ActionResult Signout(string id = "admin") { CookieHelper.ClearCookie("qrcode"); CookieHelper.ClearCookie("openid"); var url = string.Empty; if (id.ToLower() == Enums.LoginType.member.ToString().ToLower()) { CookieHelper.ClearCookie(Enums.LoginType.member.ToString()); url = "/"; } else { CookieHelper.ClearCookie(Enums.LoginType.admin.ToString()); url = "/jnwz200915"; } return(Redirect(url)); }
/// <summary> /// 注销接口 /// </summary> /// <returns></returns> public JsonResult DelCookieApi() { string mess = "", url = ConstantConfig.Login_In_Url; bool status = false; if (!string.IsNullOrEmpty(CookieHelper.GetCookieValue("UserInfo"))) { //解密 string UserDb = EncryptHelper.Decrypt(ConstantConfig.KEY, CookieHelper.GetCookieValue("UserInfo")); string[] sArray = UserDb.Split(','); UsersProvider.DelCacheList(sArray[0], sArray[1]); status = true; mess = ConstantConfig.Success; CookieHelper.ClearCookie("UserInfo"); return(Json(new { status = status, mess = mess, url = url })); } mess = ConstantConfig.Error; LogHelper.Log(mess, "异常的注销操作", "IndexController.cs:93", IpHelper.GetUserIp(), "未知", "注销操作时,没有找到Cookie值(不应该出现的错误)。"); return(Json(new { status = status, mess = mess, url = url })); }
/// <summary> /// 登出 /// </summary> /// <returns></returns> public bool Logout() { // 1、清除session IPrincipal principal = HttpContext.Current.User; FormsIdentity formsIdentity = principal.Identity as FormsIdentity; if (formsIdentity != null) { FormsAuthenticationTicket ticket = formsIdentity.Ticket; Credentials userInfo = JsonConvert.DeserializeObject <Credentials>(ticket.UserData); if (userInfo != null) { _credentialsRepository.DisableCredentials(userInfo.accesstoken); } } // 2、清除cookie CookieHelper.ClearCookie(FormsAuthentication.FormsCookieName); return(true); }
public ActionResult Index(string VCode, string UserName, string Password) { VCode = VCode.ToLower().Trim(); string name = "Epoint.PingBiao_"; VCode = name + VCode; //最后判断来源 if (CryptoHelper.MD5Encrypt(VCode) == CookieHelper.GetCookieValue("code")) { User u = userServer.CheckLogin(UserName.Trim(), Password.Trim()); if (u == null) { return(Json(new ResultModel { msg = "用户不存在", pass = false })); } else { string sid = "Epoint.PingBiao_" + StringHelper.GetGuidString(); CookieHelper.SetCookie("Admin", sid); //更新用户登录信息 u.LastLoginTime = DateTime.Now; u.LastLoginIp = HttpHelper.GetClientIPAddress(); userServer.Update(u); //加入缓存 //CacheHelper.SetCache(Constant.CacheKey.LoginAdminInfoCacheKey + "_" + sid, u,new DateTimeOffset().AddDays(1)); CacheHelper.SetCache(Constant.CacheKey.LoginAdminInfoCacheKey + "_" + sid, u); //清除验证码code CookieHelper.ClearCookie("code"); return(Json(new ResultModel { msg = "登陆成功", pass = true })); } } else { return(Json(new ResultModel { msg = "验证码错误", pass = false })); } }
public ActionResult CookDemo(FormCollection form) { string val = form["ddl"]; string Message = "成功"; if (val == "1") { Message = CookieHelper.GetCookieValue("Cook"); } if (val == "2") { CookieHelper.SetCookie("Coke", "Demo2", DateTime.Now.AddDays(1.0)); } if (val == "3") { CookieHelper.ClearCookie("Coke"); } ViewBag.Message = Message; return(View()); }
public ActionResult verification(string action, string pwd, string userid, string remember_me) { var id2 = Session.SessionID; var model = accountService.GetLoginModel(userid); if (model != null) { if (model.userpwd.ToLower() == MD5Helper.MD5_32(pwd).ToLower()) { model.login_time = DateTime.Now; Session["LoginUser"] = model; var sid = SessionHelper.SessionId; var functions = accountService.GetMyFunctionString(Masterpage.CurrUser.role_sn); Session["MyFunctionString"] = functions; if (remember_me != null && remember_me == "on") { CookieHelper.SetCookie("remember_me", remember_me, DateTime.Now.AddMonths(1)); CookieHelper.SetCookie("remember_userid", userid, DateTime.Now.AddMonths(1)); } else { CookieHelper.ClearCookie("remember_userid"); CookieHelper.ClearCookie("remember_me"); } return(Redirect("../main/index")); } else { return(RedirectToAction(action, new { url = "", v1 = "", v2 = "密码输入错误" })); //back = new ReturnValue { status = false, value2 = "密码输入错误" }; } } else { return(RedirectToAction(action, new { url = "", v1 = "用户名不存在", v2 = "" })); //return View("login", new { url = "", v1 = "用户名不存在", v2 = "" }); //back = new ReturnValue { status = false,value="用户名不存在" }; } //return Json(back, JsonRequestBehavior.AllowGet); }
protected override void OnException(ExceptionContext filterContext) { //错误处理 //判断是否登录,判断用户是否存在 if (User_Shop.IsLogin()) { if (filterContext.RequestContext.HttpContext.Request.HttpMethod.ToLower() == "get") { Account curUser = User_Shop.GetAccount(); Member_Info model = DB.Member_Info.FindEntity(curUser.Id); if (model == null) { CookieHelper.ClearCookie("openid"); User_Shop.Clear(); filterContext.Result = new RedirectResult("~/mobile/memberlogin"); filterContext.ExceptionHandled = true; } } } base.OnException(filterContext); }
public object logincheck() { if (SessionHelper.Get("AccessInfo") != null) { var login = (AccessInfo)SessionHelper.Get("AccessInfo"); return(new { status = 1, text = string.Format("您好,{0}", login.UserName) }); } else { var u = CookieHelper.GetCookieValue("User"); var p = CookieHelper.GetCookieValue("Password"); if (u != string.Empty && p != string.Empty) { var user = this.users.Find(n => n.UserName == u && n.Password == p); if (user != null) { var roles = user.Roles.Select(s => s.RoleID); SessionHelper.SetSession("AccessInfo", new AccessInfo { UserID = user.UserID, UserName = user.UserName, Authorise = this.roleAuthorise.FindAll(n => roles.Contains(n.RoleID)).Select(s => s.AuthoriseID).ToList() }); return(new { status = 1, text = string.Format("您好,{0}", user.UserName) }); } else { CookieHelper.ClearCookie("User"); CookieHelper.ClearCookie("Password"); return(new { status = 0 }); } } else { return(new { status = 0 }); } } }
public ActionResult LoginOut() { FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(CookieHelper.GetCookieValue("Member")); //移除缓存的登录用户信息 CacheHelper.RemoveAllCache(Constant.CacheKey.LoginUserInfoCacheKey + "_Member_" + ticket.UserData); //用户注销 CookieHelper.ClearCookie("Member"); if (HttpContext.Request.IsAjaxRequest()) { return(Json(new { pass = true, msg = "退出成功" }, JsonRequestBehavior.AllowGet)); } else { return(Redirect("/Store/Index")); } }
public ActionResult Logout() { string token = CookieHelper.GetCookieValue("Admin"); //移除缓存的登录用户信息 //CacheHelper.RemoveCache(Constant.CacheKey.LoginAdminInfoCacheKey + "_" + token); base.cacheService.Remove(Constant.CacheKey.LoginAdminInfoCacheKey + "_" + token); //用户注销 //FormsAuthentication.SignOut(); CookieHelper.ClearCookie("Admin"); base.logService.WriteLog(LoginUser.User_Id, "退出系统"); if (HttpContext.Request.IsAjaxRequest()) { return(Json(new ResultModel { pass = true, msg = "退出成功" }, JsonRequestBehavior.AllowGet)); } else { return(Redirect("/AdminLogin/Index")); } }
public static void OwinSignOut(this IAuthenticationManager authenticationManager) { //CookieHelper.SetCookie<string>(ApplicationConstants.COOKIE_STORENUMBER, ApplicationConstants.SELECT_DEFAULT); CookieHelper.ClearCookie(ApplicationConstants.COOKIE_TOKEN); authenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); }
/// <summary> /// 退出 /// </summary> /// <returns></returns> public ActionResult Logout() { Session[CommonHelper.SessionUserKey] = null; CookieHelper.ClearCookie(CommonHelper.Md5(CommonHelper.COOKIE_KEY_USERINFO)); return(RedirectToAction("Login")); }
public JsonResult Connect(ConnectionSettingsModel connectionSettings, RequestInfoModel requestInfo) { try { InstallationComponentsModel installedComponents = null; InstallationComponentsModel selectedComponents = null; InstallationProgressModel installationProgress = null; OsInfo osInfo = null; if (connectionSettings != null) { if (connectionSettings.Enterprise) { if (string.IsNullOrEmpty(connectionSettings.LicenseKey)) { throw new ArgumentException("connectionSettings.licenseKey"); } if (connectionSettings.LicenseKey == Settings.TrialFileName && requestInfo == null) { throw new ArgumentNullException("requestInfo"); } } var data = SshHelper.Connect(UserId, connectionSettings); osInfo = data.Item1; installedComponents = data.Item2; installationProgress = CacheHelper.GetInstallationProgress(UserId); selectedComponents = CacheHelper.GetSelectedComponents(UserId); CacheHelper.SetConnectionSettings(UserId, connectionSettings); CacheHelper.SetInstalledComponents(UserId, installedComponents); CacheHelper.SetRequestInfo(UserId, requestInfo); } else { CookieHelper.ClearCookie(); CacheHelper.ClearUserCache(UserId); } return(Json(new { success = true, message = string.Empty, connectionSettings = GetJsonString(connectionSettings), installedComponents = GetJsonString(installedComponents), installationProgress = GetJsonString(installationProgress), selectedComponents = GetJsonString(selectedComponents), osInfo = GetJsonString(osInfo) })); } catch (Exception ex) { LogManager.GetLogger("ASC").Error(ex.Message, ex); return(Json(new { success = false, message = ex.Message, errorCode = GetErrorCode(ex.Message) })); } }
/// <summary> /// 退出登录 /// </summary> /// <returns></returns> public ActionResult LogOut() { CookieHelper.ClearCookie(KeyHelper.COOKIE_ADMIN_USERID); SessionHelper.Del(KeyHelper.SESSION_ADMIN_INFO); return(RedirectToAction("Index", "Login")); }
// GET: Test //public ActionResult GetCookie2() //{ // var cookie = CookieHelper.GetCookie(); // //CookieHelper.SetOpenId(Guid.NewGuid().ToString(), DateTime.Now.ToString()); // return Content(SerializeHelper.Serialize(cookie)); //} //[AccountIdentity] //public ActionResult GetCookie() //{ // var cookie = CookieHelper.GetCookie(); // return Content(SerializeHelper.Serialize(cookie)); //} public ActionResult ClearCookie() { CookieHelper.ClearCookie(); return(Content("ok111")); }