public static void Logout(HttpSessionState session) { session.Remove("Username"); session.Remove("userObj"); session.Remove("stockID"); session.Remove("StockName"); }
public void Remove(Enum name) { if (_session != null) { _session.Remove(name.ToString()); } }
public static object GetWithTimeout( this HttpSessionState session, string name) { object value = session[name]; if (value == null) { return(null); } DateTime?expDate = session[name + "ExpDate"] as DateTime?; if (expDate == null) { return(null); } if (expDate < DateTime.Now) { session.Remove(name); session.Remove(name + "ExpDate"); return(null); } return(value); }
public void Set(string key, object value) { if (value == null) { _session.Remove(BuildFullKey(key)); } else { _session[BuildFullKey(key)] = value; } }
public static void Remove(String index) { if (_internalStorage != null) { _internalStorage.Remove(index); } }
/// <summary> /// Elimina la referencia del usuario en sesión para finalizarla. /// </summary> public static void EndSession() { if (GetUser() != null) { sessionState.Remove("SessionCreated"); } }
/// <summary> /// 设置指定Session对象信息 /// </summary> /// <param name="SE">服务器会话信息</param> /// <param name="InfoName">Session对象名称</param> /// <param name="InfoValue">Session对象的值</param> /// <returns></returns> public static bool SetSessionInfo(HttpSessionState SE, object InfoName, object InfoValue) { if ((SE == null) || (InfoName == null)) { return(false); } if (SE["_SessionInfo"] == null) { SE["_SessionInfo"] = new Hashtable(); } Hashtable hashtable = SE["_SessionInfo"] as Hashtable; if (hashtable == null) { SE.Remove("_SessionInfo"); SE.Add("_SessionInfo", new Hashtable()); } if (hashtable.ContainsKey(InfoName)) { hashtable[InfoName] = InfoValue; } else { hashtable.Add(InfoName, InfoValue); } return(true); }
/// <summary> /// 删除session /// </summary> /// <param name="session"></param> /// <param name="keys"></param> public static void RemoveSession(HttpSessionState session, params string[] keys) { foreach (var key in keys) { session.Remove(key); } }
public static void RemoveFrom(HttpSessionState session) { if (IsIn(session)) { session.Remove(Key); } }
public static string GetMessage(this HttpSessionState Session) { var value = Session["Message"] as string; Session.Remove("Message"); return(value); }
public static bool?GetIsSuccess(this HttpSessionState Session) { var value = Session["Success"] as bool?; Session.Remove("Success"); return(value); }
public static string GetUserName(HttpContext context) { HttpRequest Request = context.Request; HttpSessionState Session = context.Session; string fullUserName = Request.ServerVariables["LOGON_USER"].ToString(); string userName = GetUserName(fullUserName); if (IsSiteAdmin(Request, userName)) { string sessionName = "ImpersonateUser"; string userQS = Request.QueryString.Get("user"); if (userQS != null) { if (userQS == "clear") { Session.Remove(sessionName); } else { userName = userQS; Session[sessionName] = userQS; } context.Response.Redirect(Web.RemoveQSValue(Request.RawUrl, "user")); } else if (Session[sessionName] != null) { userName = Session[sessionName].ToString(); } } return(userName); }
public static void DeleteOldSession(List <Job> job, HttpSessionState session) { if (job[0] != null) { session.Remove("Job_" + job[0].JobId); } }
/// <summary> /// 保存临时数据 /// </summary> /// <param name="controllerContext"></param> /// <param name="values"></param> public virtual void SaveTempData(ControllerContext controllerContext, IDictionary <string, object> values) { if (controllerContext == null) { throw new ArgumentNullException("controllerContext"); } HttpSessionState session = controllerContext.HttpContext.Session; bool hasData = values != null && values.Count > 0; if (session == null) { if (hasData) { throw new InvalidOperationException("Session为null"); } } else { if (hasData) { session[TempDataSessionStateKey] = values; } else if (session[TempDataSessionStateKey] != null) { session.Remove(TempDataSessionStateKey); } } }
//退出登录(放这里了... // DELETE api/<controller>/5 public string Delete() { HttpSessionState session = HttpContext.Current.Session; session.Remove(SessionContant.LoginUser); return(JsonConvert.SerializeObject(new ResultResponse(200, "success"))); }
/// <summary> /// Se encarga de eliminar el id persistido en sesión. /// </summary> /// <param name="session"></param> public static void FlushId(HttpSessionState session) { if (Exist(UBIQUICITY_ITEM_ID, session)) { session.Remove(UBIQUICITY_ITEM_ID); } }
public virtual void RemoveObject() { if (session[GetSessionKey()] != null) { session.Remove(GetSessionKey()); } }
internal void WebRequestSessionEnd() { if (this.WebRequestState < 3) { if (this.Enabled == true && this.webBarPanels != null) { this.WebRequestEndTime = Debug.GetProcessingTime(); HttpSessionState session = HttpContext.Current.Session; List <List <RenderedPanel> > sessionStorrage = Dispatcher.webGetSessionStorrage(); this.webRedirect = Dispatcher.webCheckIfResponseIsRedirect(); if (this.webRedirect == true) { this.webRequestSessionEndCallBarPanelsSessionEnd(); List <RenderedPanel> renderedPanels = HtmlResponse.RenderDebugPanels(this.webBarPanels); sessionStorrage.Insert(0, renderedPanels); if (session is HttpSessionState) { session[Debug.SESSION_STORAGE_KEY] = sessionStorrage; } this.webBarPanels = null; // frees memory } else { this.webReqEndSession = sessionStorrage; // clear session storage, panels will be rendered in this request end event if (session is HttpSessionState && session[Debug.SESSION_STORAGE_KEY] != null) { session.Remove(Debug.SESSION_STORAGE_KEY); } this.webRequestSessionEndCallBarPanelsSessionEnd(); } } this.WebRequestState = 3; } }
/// <summary> /// Se encarga de eliminar los elementos persistidos en sesión. /// </summary> /// <param name="session"></param> public static void FlushPollQuestion(HttpSessionState session) { if (Exist(POLL_QUESTION, session)) { session.Remove(POLL_QUESTION); } pollQuestionEdited = false; }
/// <devdoc> /// To be supplied. /// </devdoc> public override void Save() { bool requiresControlStateInSession = false; object clientData = null; Triplet vsTrip = ViewState as Triplet; // no session view state to store. if ((ControlState != null) || ((vsTrip == null || vsTrip.Second != null || vsTrip.Third != null) && ViewState != null)) { HttpSessionState session = Page.Session; string sessionViewStateID = Convert.ToString(DateTime.Now.Ticks, 16); object state = null; requiresControlStateInSession = Page.Request.Browser.RequiresControlStateInSession; if (requiresControlStateInSession) { // ClientState will just be sessionID state = new Pair(ViewState, ControlState); clientData = sessionViewStateID; } else { // ClientState will be a <sessionID, ControlState> state = ViewState; clientData = new Pair(sessionViewStateID, ControlState); } string sessionKey = _viewStateSessionKey + sessionViewStateID; session[sessionKey] = state; Queue queue = session[_viewStateQueueKey] as Queue; if (queue == null) { queue = new Queue(); session[_viewStateQueueKey] = queue; } queue.Enqueue(sessionKey); SessionPageStateSection cfg = RuntimeConfig.GetConfig(Page.Request.Context).SessionPageState; int queueCount = queue.Count; if (cfg != null && queueCount > cfg.HistorySize || cfg == null && queueCount > SessionPageStateSection.DefaultHistorySize) { string oldSessionKey = (string)queue.Dequeue(); session.Remove(oldSessionKey); } } if (clientData != null) { Page.ClientState = Util.SerializeWithAssert(StateFormatter2, new Pair(requiresControlStateInSession, clientData), Purpose.WebForms_SessionPageStatePersister_ClientState); } }
public bool Remove(string name) { if (!ContainsKey(name)) { return(false); } _sessionState.Remove(name); return(true); }
/// <summary> /// ユーザー情報モデル破棄 /// </summary> public void ClearUserInfoModel() { HttpSessionState session = HttpContext.Current.Session; session.Remove("UserInfoModel"); // 認証 FormsAuthentication.SignOut(); }
/// <summary> /// 清除登录状态 /// </summary> public static void ClearLoginState() { HttpSessionState session = HttpContext.Current.Session; if (session[SK_USER] != null) { session.Remove(SK_USER); } }
public static void Remove(string key) { HttpSessionState state = System.Web.HttpContext.Current.Session; if (state != null) { state.Remove(key); } }
public static void Set(this HttpSessionState session, string name, object value) { if (session[name] != null) { session.Remove(name); } session.Add(name, value); }
// static helper - should be called by Global.asax.cs.Session_End public static void SessionEnd(HttpSessionState session) { var scope = (ILifetimeScope)session[Key]; if (scope != null) { scope.Dispose(); session.Remove(Key); } }
public static void RemoveKeys(this HttpSessionState pair, string[] keys) { if (pair != null) { foreach (var key in keys) { pair.Remove(key); } } }
public void RemoveFromSession(string sessionKey) { HttpSessionState currentSession = GetCurrentHttpContest().Session; if (currentSession == null) { return; } currentSession.Remove(sessionKey); }
public static void setCallerCredentials(Credentials currentCallerCredentials, IPrincipal principal) { if (currentCallerCredentials == null) { currentHttpSession.Remove("credentials"); } else { currentHttpSession["credentials"] = currentCallerCredentials; } if (principal == null) { currentHttpSession.Remove("principal"); } else { currentHttpSession["principal"] = principal; } }
public static HROne.SaaS.Entities.EUser GetCurUser(HttpSessionState Session) { DatabaseConnection dbConn = HROne.Common.WebUtility.GetDatabaseConnection(Session); HROne.SaaS.Entities.EUser CurrentUser = null; if (Session["User"] == null) { if (Session["LoginID"] != null) { HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.Rijndael); if (Session["LoginID"].ToString().Equals(crypto.Encrypting("EM", Session.SessionID))) { CurrentUser = new HROne.SaaS.Entities.EUser(); CurrentUser.LoginID = "EM"; CurrentUser.UserID = -1; } if (Session["PasswordEncrypted"] != null) { HROne.SaaS.Entities.EUser user = null; if (ValidateUser(dbConn, Session["LoginID"].ToString(), Session["PasswordEncrypted"].ToString(), false, false, out user)) { CurrentUser = user; } else { Session.Remove("LoginID"); Session.Remove("PasswordEncrypted"); } } } if (CurrentUser != null) { Session["User"] = CurrentUser; } } else { CurrentUser = (HROne.SaaS.Entities.EUser)Session["User"]; } return(CurrentUser); }