/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> internal static BaseSessionObject GetSessionObject(User user) { BaseSessionObject sessionObject = CreateSessionObject(); sessionObject.Init(user); var context = HttpContextUtilities.GetHttpContext(); SaveSessionObjectToHttpContext(sessionObject, context); return(sessionObject); }
/// <summary> /// Create a session object for specific user account /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> internal static BaseSessionObject GetSessionObject(string username, string password) { BaseSessionObject sessionObject = CreateSessionObject(); sessionObject.Init(username, password); var context = HttpContextUtilities.GetHttpContext(); SaveSessionObjectToHttpContext(sessionObject, context); return(sessionObject); }
/// <summary> /// Save session object to http context so that other http modules and handlers can use it without initializing again /// </summary> /// <param name="sessionObject"></param> /// <param name="context"></param> private static void SaveSessionObjectToHttpContext(BaseSessionObject sessionObject, HttpContextBase context) { if (context == null) { return; } if (context.Items.Contains(SESSION_NAME)) { context.Items[SESSION_NAME] = sessionObject; } else { context.Items.Add(SESSION_NAME, sessionObject); } }
private static BaseSessionObject CreateSessionObjectFromConfiguration() { BaseSessionObject sessionObject = null; Type sessionType = Type.GetType("Misuka.Domain.Providers.SessionObject"); try { if (sessionType != null) { sessionObject = (BaseSessionObject)Activator.CreateInstance(sessionType); } } catch (Exception ex) { throw new ConfigurationErrorsException("Could not create an instance of DashboardSession", ex); } return(sessionObject); }
public static void ResetSessionObject() { _sessionObject = null; }
internal static void SetSessionObject(BaseSessionObject sessionObject) { _sessionObject = sessionObject; }
internal UserSession(BaseSessionObject sessionObject) { _sessionObject = sessionObject; }
internal UserSession(User loggingUser) { _sessionObject = SessionObjectFactory.GetSessionObject(loggingUser); }
public UserSession() { _sessionObject = SessionObjectFactory.GetSessionObject(); }
/// <summary> /// Save session object to http context so that other http modules and handlers can use it without initializing again /// </summary> /// <param name="sessionObject"></param> /// <param name="context"></param> private static void SaveSessionObjectToHttpContext(BaseSessionObject sessionObject, HttpContextBase context) { if (context == null) return; if (context.Items.Contains(SESSION_NAME)) context.Items[SESSION_NAME] = sessionObject; else context.Items.Add(SESSION_NAME, sessionObject); }