public Task <ISession> AccessAsync(IOwinContext context)
        {
            OnSessionRequest();

            CookieSession session;

            session = GetCurrentSession(context);
            if (session == null)
            {
                string sessionid = Guid.NewGuid().ToString();
                session = new CookieSession()
                {
                    ID = sessionid
                };
                store.SetSession(sessionid, session);
                context.Response.Cookies.Append("YOYOFx_SessionID", sessionid);
            }
            session.RefreshSessionAccessTime();
            store.SetSession(session.ID, session);

            if (!context.Items.ContainsKey("session"))
            {
                context.Items.Add("session", session);
            }
            else
            {
                context.Items["session"] = session;
            }


            return(Task.FromResult((ISession)session));
        }
Exemplo n.º 2
0
        internal CookieSession GetSession(string sessionid)
        {
            CookieSession session = null;

            sessionStore.TryGetValue(sessionid, out session);

            return(session);
        }
Exemplo n.º 3
0
 internal void SetSession(string id, CookieSession session)
 {
     if (sessionStore.ContainsKey(id))
     {
         sessionStore[id] = session;
     }
     else
     {
         sessionStore.Add(id, session);
     }
 }
 private void SetSession(string id, CookieSession session)
 {
     store.SetSession(id, session);
 }