Beispiel #1
0
        public void Login(LoginVisualEntity info)
        {
            string sessionID = Guid.NewGuid().ToString();

            System.Web.HttpContext.Current.Response.Cookies.Set(new HttpCookie(cookieName, sessionID));
            SessionStateManage.SetLogin(sessionID, info);
        }
Beispiel #2
0
        public static void SetLogin(string cookieName, LoginVisualEntity user)
        {
            redisHelper.StringSet(cookieName, user.UserName);
            redisHelper.KeyExpire(cookieName, new TimeSpan(0, SessionTimeOut, 0));

            redisHelper.HashSet(user.UserName, user);
        }
Beispiel #3
0
        public BaseController()
        {
            cookieName = SessionStateManage.CookieName;

            HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies[cookieName];

            if (cookie != null)
            {
                SessionCookieValue = cookie.Value;
                if (string.IsNullOrEmpty(SessionCookieValue))
                {
                    UserSession = SessionStateManage.GetUser(SessionCookieValue);
                }
            }
        }
Beispiel #4
0
 //[HttpPost]
 public JsonResult LoginPost(LoginVisualEntity loginVisualEntity)
 {
     if (string.IsNullOrWhiteSpace(loginVisualEntity.UserName))
     {
         //return JsonResult(new { IsSuccess=false,Message=""},);
         //return ContentResult(new { });
     }
     if (string.IsNullOrWhiteSpace(loginVisualEntity.Password))
     {
     }
     if (UserSession == null)
     {
         UserSession = new LoginVisualEntity {
             Password = loginVisualEntity.Password, UserName = loginVisualEntity.UserName
         };
         Login(UserSession);
     }
     return(Json(new { IsSuccess = true, Message = "" }));
 }