asp.net - Allow only a single login session per user -


essentially asking this question here, using asp identity instead of asp.net membership provider, , that, answer of no use me.

figured out how it. on login call this:

var key = user.username; var timeout = new timespan(0, 0, httpcontext.current.session.timeout, 0, 0); httpcontext.current.cache.insert(key, session.sessionid, null, datetime.maxvalue, timeout, cacheitempriority.notremovable, null); 

and in global.asax

if (session["username"] != null)     {         var cachekey = session["username"].tostring();         if ((string) httpcontext.current.cache[cachekey] != session.sessionid) logout();     } 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -