Hi, i am using a flag in the database to detect if the user is logged in or not. But this flag is updated only if the user logs in or logs out.If the user closes the browser or somehow gets out of the site without logging out he has to wait for the session to be timed out to log in again as concurrent log in has been obstructed in my application.
Now is it possible in .net to see while logging in that if the user is having any active session without checking the database?If that is possible then i will allow the user to log in if he has an inactive session running.
Plz help.

Recommended Answers

All 2 Replies

I am guessing you are storing the sessionID in the database for that account? If so then who cares if they leave your site and come back or if they close their browser and re-opens it.

The idea is to only allow the user one session while on the site. So when the user logs in you save the sessionID to the database. Now as long as the session is good. When you check to see if what is stored in the database matches the current session of the user it should match. If not send them to the login page. This stops users from running more then one browser at a time on your site.

So if I am a user on your site and I login with my browser, then if I open another browser and login again. Now the first browser session will not match the sessionID that is stored in the database and that browser will be sent back to the login page. But all this does require you to check the sessionID that is stored in the database on each page load.

There is one thing I forgot to bring up. With most browsers now a days having tabs. A user can login and then open another tab. Since both tabs are on the same browser then the session is the same for both of them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.