Click here to Skip to main content
15,895,829 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to restrict the number of users that is in my application only 20 users are logged in. If user 21 is Logging and 20 users are already logged than number 21 is not able to login...than admin forcefully signout any of the 20 users and 21 is able to login..so how can i forcefully signout the user. After Deleting the sessionid of that particular user, if that user is refreshing the page then the session id is retrieved from the viewstate. So, how can i completely logout the user from admin in ASP.NET using Global.asax.

What I have tried:

I tried deleting the session id from the database but not able to clear the sessionid of that particular user at the client side.
Posted
Comments
ZurdoDev 15-Jul-16 7:58am    
I don't think you can. What you could do is keep a table of session ids and a flag in the table to abandon it the next it is used. Then if all your pages inherit from the same custom class you could add code to check if the session needs to be closed and then call Session.Abandon().

However, I think this is poor user design. Users would be pretty upset I think to get kicked out. I think a better idea is rather than having the admin kicking someone out just don't let anymore in if they are not an admin.
F-ES Sitecore 15-Jul-16 8:20am    
I would abandon this idea, you won't get it working. For a start authentication is nothing to do with sessions, you can be authenticated with no session and vice versa. Secondly, how do you define who is logged in? The web is stateless so it has no idea who is logged in or browsing your site or has shut their browser down or gone idle.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900