Esempio n. 1
0
        public static Session RefreshSession()
        {
            var session = new Session(ObjectFactory.GetInstance<IIdentityRepository>());
            HttpContext.Current.Session[SESSION_KEY] = session;

            return session;
        }
Esempio n. 2
0
        private static bool UserHasChanged(Session currentSession)
        {
            var identity = HttpContext.Current.User.Identity;
            var formsIdentity = identity as FormsIdentity;
            UserData userData;

            userData = formsIdentity != null ? GetUserData(formsIdentity.Ticket.UserData) : new UserData { FriendlyName = identity.Name };

            if (string.IsNullOrEmpty(userData.FriendlyName))
            {
                userData.FriendlyName = identity.Name;
            }

            return (currentSession.User != null && userData.Identifier == null)
                || (currentSession.User == null && userData.Identifier != null)
                || (currentSession.User != null && userData.Identifier != null && !userData.Identifier.Equals(currentSession.User.Identifier));
        }