Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="clearAuthentication"></param>
        /// <param name="user"></param>
        private void LogoutForWinCE(bool clearAuthentication, SsbUser user)
        {
            OperationContext context = OperationContext.Current;
            //获取传进的消息属性
            MessageProperties properties = context.IncomingMessageProperties;
            //获取消息发送的远程终结点IP和端口
            RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            string IP = endpoint.Address;


            if (IP == "::1")
            {
                IP = "127.0.0.1";
            }
            SslLoginLog log = new SslLoginLog();

            log.UserId     = user == null ? -99 : user.ObjId;
            log.LoginIp    = IP;
            log.LogoutTime = DateTime.Now;
            this.UpdateUserLoginLog(log);
            if (clearAuthentication)
            {
                FormsAuthentication.SignOut();
                HttpContext.Current.Session.Clear();
            }
        }
Exemple #2
0
        /// <summary>
        /// 修改用户推出登录时信息
        /// </summary>
        /// <param name="log"></param>
        public void UpdateUserLoginLog(SslLoginLog log)
        {
            var service = TableViewServiceFactory.CreateInstance <ISslLoginLogService>();

            service.Update(log, new SslLoginLog()
            {
                UserId = log.UserId
            });
        }
Exemple #3
0
        /// <summary>
        /// 登录成功
        /// </summary>
        /// <param name="user"></param>
        private void LoginSuccess(SsbUser user)
        {
            Logout(false, user);
            SslLoginLog loginlog = new SslLoginLog();

            loginlog.UserId     = user.ObjId;
            loginlog.LoginTime  = DateTime.Now;
            loginlog.LogoutTime = null;
            loginlog.LoginIp    = HttpContext.Current.Request.UserHostAddress;
            if (loginlog.LoginIp == "::1")
            {
                loginlog.LoginIp = "127.0.0.1";
            }
            TableViewServiceFactory.CreateInstance <ISslLoginLogService>().Insert(loginlog);
        }
Exemple #4
0
        private void LoginSuccessForWinCE(SsbUser user)
        {
            LogoutForWinCE(false, user);
            OperationContext context = OperationContext.Current;
            //获取传进的消息属性
            MessageProperties properties = context.IncomingMessageProperties;
            //获取消息发送的远程终结点IP和端口
            RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            SslLoginLog loginlog = new SslLoginLog();

            loginlog.UserId     = user.ObjId;
            loginlog.LoginTime  = DateTime.Now;
            loginlog.LogoutTime = null;
            loginlog.LoginIp    = endpoint.Address;;
            if (loginlog.LoginIp == "::1")
            {
                loginlog.LoginIp = "172.0.0.1";
            }
            TableViewServiceFactory.CreateInstance <ISslLoginLogService>().Insert(loginlog);
        }
Exemple #5
0
        /// <summary>
        /// 退出登录
        /// </summary>
        /// <param name="clearAuthentication"></param>
        /// <param name="user"></param>
        private void Logout(bool clearAuthentication, SsbUser user)
        {
            string IP = HttpContext.Current.Request.UserHostAddress;


            if (IP == "::1")
            {
                IP = "127.0.0.1";
            }
            SslLoginLog log = new SslLoginLog();

            log.UserId     = user == null ? -99 : user.ObjId;
            log.LogoutIp   = IP;
            log.LogoutTime = DateTime.Now;
            this.UpdateUserLoginLog(log);
            if (clearAuthentication)
            {
                FormsAuthentication.SignOut();
                HttpContext.Current.Session.Clear();
            }
        }