Exemple #1
0
        public UserSession()
        {
            string pl_strErrMsg     = string.Empty;
            string pl_strCookieInfo = string.Empty;

            string[]   pl_arrCookieInfo = null;
            HttpCookie pl_objCookie     = null;

            _isLogin = false;

            try
            {
                pl_objCookie = HttpContext.Current.Request.Cookies[UserGlobal.BOQ_DEFAULT_COOKIE];
                if (pl_objCookie == null)
                {
                    pl_strErrMsg = "쿠키 " + UserGlobal.BOQ_DEFAULT_COOKIE + " 조회 실패";
                    _isLogin     = false;
                    return;
                }
                else if (string.IsNullOrEmpty(pl_objCookie.Value))
                {
                    pl_strErrMsg = "쿠키 " + UserGlobal.BOQ_DEFAULT_COOKIE + " 조회 - 빈값";
                    _isLogin     = false;
                    return;
                }

                pl_strCookieInfo = UserGlobal.GetDecryptStr(pl_objCookie.Value);
                if (string.IsNullOrEmpty(pl_strCookieInfo))
                {
                    pl_strErrMsg = "쿠키 " + UserGlobal.BOQ_DEFAULT_COOKIE + " 정보 조회 실패";
                    _isLogin     = false;
                    return;
                }

                pl_arrCookieInfo = pl_strCookieInfo.Split('/');
                if (!pl_arrCookieInfo.Length.Equals(7))
                {
                    pl_strErrMsg = "쿠키 " + UserGlobal.BOQ_DEFAULT_COOKIE + " 상세 정보 조회 실패";
                    _isLogin     = false;
                    return;
                }

                Int32.TryParse(pl_arrCookieInfo[0], out _intUserNo);
                _strUserID   = pl_arrCookieInfo[1];
                _strUserName = pl_arrCookieInfo[2];
                _strPhoneNo  = pl_arrCookieInfo[3];
                Int16.TryParse(pl_arrCookieInfo[4], out _intUserAuth);
                Int16.TryParse(pl_arrCookieInfo[5], out _intUserRole);
                Int16.TryParse(pl_arrCookieInfo[6], out _intStateCode);

                if (!_intUserNo.Equals(0) && !string.IsNullOrEmpty(_strUserID))
                {
                    _isLogin = true;

                    var encFamilyEventNo = HttpContext.Current.Request.QueryString["encfamilyeventno"];

                    if (!string.IsNullOrWhiteSpace(encFamilyEventNo))
                    {
                        Int64 intDecFamilyEventNo = Convert.ToInt64(UserGlobal.GetDecryptStr(encFamilyEventNo));

                        InsFamilyEventJoin(_intUserNo, intDecFamilyEventNo, out pl_strErrMsg);
                    }
                }
            }
            catch (Exception pl_objEx)
            {
                //사용자 정보 초기화
                LogOut();
                UtilLog.WriteExceptionLog(pl_objEx.Message, pl_objEx.StackTrace);
            }
            finally
            {
                pl_objCookie = null;
                if (!_isLogin)
                {
                    LogOut();
                    UtilLog.WriteCommonLog("UserSession", "UserSession", pl_strErrMsg);

                    Uri referrer = HttpContext.Current.Request.UrlReferrer;
                    if (referrer != null)
                    {
                        UtilLog.WriteCommonLog("UserSession", "UserSession", "요청위치: " + referrer.OriginalString.ToLower());
                    }
                }
            }

            return;
        }