public JsonResult ActiveUser(string key) { AjaxResult result = new AjaxResult(); if (MemcachedHelper.Get(key) != null) { string userName = MemcachedHelper.Get(key).ToString(); UserInfo userInfo = this._userService.GetEntity(u => u.UserName == userName); if (userInfo == null) { result.Success = false; result.Message = "此用户没有注册!"; } else { userInfo.Activate = "Y"; this._userService.Update(userInfo); result.Success = true; } MemcachedHelper.Delete(key); } else { result.Success = false; result.Message = "此激活链接已失效!"; } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 清空缓存和session中存的值 /// </summary> public static void ClearUserInfo() { UserContext.LoginUser = null; if (Request.Cookies[ConstInfo.SessionID] != null) { string sessionId = Request.Cookies[ConstInfo.SessionID].Value; MemcachedHelper.Delete(sessionId); } WebHelper.RemoveCookie(ConstInfo.SessionID); WebHelper.RemoveCookie(ConstInfo.CookieName); }
public ActionResult Logout() { if (Request.Cookies["sessionId"] != null) { var key = Request.Cookies["sessionId"].Value; MemcachedHelper.Delete(key); Response.Cookies["cp1"].Expires = DateTime.Now.AddDays(-1); Response.Cookies["cp2"].Expires = DateTime.Now.AddDays(-1); } //return RedirectToAction("Index"); return(Redirect("/Login/Index")); }