I have a Admin and I want to give a feature where Admin can end other user's session. Is this really possible? I know sessions are stored individually and normally nobody would do what I want but is this really possible? If yes, then how?
Thanks in advance :开发者_开发技巧)
You could use the Admin session to write a boolean variabile (e.g. ResetSessions=true) in the Application context, that each User session would read and call a Reset method if necessary.
// Admin
Application["ResetSessions"] = true;
// User
if (Convert.ToBoolean(Application["ResetSessions"]))
{
... reset session ...
}
You could create a ApplicationSession which hold a list of UserId's, every time the user loads a page check if the userId is in that list, if they are then logged them out.
精彩评论