473,416 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

how to prevent multiple logins from the same user

Hi All

i need to prevent multiple logins from the same user at the same time.
what is the best way to do this .

How can i detect if a user closes the browser window without logging
out so tht his/her id can be removed from the global list maintained
for the looged in users
Kindly help

Regards,

Anoj Kumar

Nov 19 '05 #1
6 4358
anoj wrote:
Hi All

i need to prevent multiple logins from the same user at the same time.
what is the best way to do this .

How can i detect if a user closes the browser window without logging
out so tht his/her id can be removed from the global list maintained
for the looged in users
Kindly help

Regards,

Anoj Kumar


There is no "configuration setting" for this, you have to build it yourself.
You need to maintain a global list of "logged in users". If someone tries
to log in, check against this list and display a "already logged in"
message.
You need to add code to the Session_End event handler to remove
users from this list if their session expires (when they just left the site/closed
their browser instead of logging out).

Be careful: users that had a browser-crash that prevented them from logging out,
now need to wait 20 minutes before they can access your site again!
The fact that your user is logged in in some session that he/she can't log out
of, doesn't have to be his/her fault!

Hans Kesting
Nov 19 '05 #2
there is no reliable way to detect browser close, or if the user just
navigated to another site.

your best option is to use a ticket system. when the user hits a page, give
out a ticket (in a hidden field) and test for it on postback. allow only one
active ticket per user. you can also timeout the ticket, and require a new
login. if the user requests a new page, cancel the old ticket, and assign a
new ticket. this handles the user closing the browser or navigating away
from yor site, then coming back.

-- bruce (sqlwork.com)
"anoj" <su********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
| Hi All
|
| i need to prevent multiple logins from the same user at the same time.
| what is the best way to do this .
|
| How can i detect if a user closes the browser window without logging
| out so tht his/her id can be removed from the global list maintained
| for the looged in users
|
|
| Kindly help
|
| Regards,
|
| Anoj Kumar
|
Nov 19 '05 #3
You can write a HttpModule and update a datastore with a timestamp and the
ip address per user on every request and check on AuthenticateRequest if the
user matches or a defined time has expired the users session.

--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/
"anoj" <su********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi All

i need to prevent multiple logins from the same user at the same time.
what is the best way to do this .

How can i detect if a user closes the browser window without logging
out so tht his/her id can be removed from the global list maintained
for the looged in users
Kindly help

Regards,

Anoj Kumar

Nov 19 '05 #4
"Daniel Fisher(lennybacon)" <info@(removethis)lennybacon.com> wrote in
message news:e3**************@TK2MSFTNGP09.phx.gbl...
You can write a HttpModule and update a datastore with a timestamp and the
ip address per user on every request and check on AuthenticateRequest if
the user matches or a defined time has expired the users session.


The IP address is subject to change without notice between connections. What
if the user winds up switching which proxy server is being used, or if the
network gets reconfigured some other way?

If you want a value to use as a unique identifier of a machine, then send
that machine a GUID in a cookie. Then it won't matter how the network
changes out from under you.

John Saunders
Nov 19 '05 #5
I am sorry but I need the 101 version of this.
Another use suggested adding code to the Session_End event. This makes sense
but I don't see the Session_End event in the list of available events to add
in the Init from HttpApplication.
When you mention a user "hitting" a page do you mean begin request? How do I
know what the user is at that point? How do I "give out a ticket" in a hidden
field. I am assuming that this involves modifying the "normal" response page
generated for the request. Where would be the best place to do this?
From another post I read that the HttpApplication class is pooled and the
HttpModules are created from HttpApplication class as specified in
web.config. Based on this information there doesn't seem to be a global place
to reliably keep state for the application. Right?

Thank you for your input.

Kevin

"bruce barker" wrote:
there is no reliable way to detect browser close, or if the user just
navigated to another site.

your best option is to use a ticket system. when the user hits a page, give
out a ticket (in a hidden field) and test for it on postback. allow only one
active ticket per user. you can also timeout the ticket, and require a new
login. if the user requests a new page, cancel the old ticket, and assign a
new ticket. this handles the user closing the browser or navigating away
from yor site, then coming back.

-- bruce (sqlwork.com)
"anoj" <su********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
| Hi All
|
| i need to prevent multiple logins from the same user at the same time.
| what is the best way to do this .
|
| How can i detect if a user closes the browser window without logging
| out so tht his/her id can be removed from the global list maintained
| for the looged in users
|
|
| Kindly help
|
| Regards,
|
| Anoj Kumar
|

Nov 19 '05 #6
My suggestion would be to keep track of the current sessionID and last page
request time for the user in a datasource record.

In the Authentication_Request event in the Global.asax, if the user is
authenticated you would write the current time and sessionID to the record.
Prior to that in the same event, you would check to see if there is an entry
for the same user that has 1) a different sessionID, and 2) if the
difference between the current time and the last entry is greater than the
timeout period.

If there is a time entry difference that is less than the timeout, and the
sessionID is different, deny the authentication, otherwise let it through
and write the entry with the new time and SessionID.

In the Session_End event, set the time in the datasource record to a date
and time sometime way in the past (1/1/1900 0100 AM) for any record with the
SessionID in that event.

I'm sure there are a number of ways to do it, but I think this would work.

-Darrin

"Kevin Burton" <Ke*********@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
I am sorry but I need the 101 version of this.
Another use suggested adding code to the Session_End event. This makes
sense
but I don't see the Session_End event in the list of available events to
add
in the Init from HttpApplication.
When you mention a user "hitting" a page do you mean begin request? How do
I
know what the user is at that point? How do I "give out a ticket" in a
hidden
field. I am assuming that this involves modifying the "normal" response
page
generated for the request. Where would be the best place to do this?
From another post I read that the HttpApplication class is pooled and the
HttpModules are created from HttpApplication class as specified in
web.config. Based on this information there doesn't seem to be a global
place
to reliably keep state for the application. Right?

Thank you for your input.

Kevin

"bruce barker" wrote:
there is no reliable way to detect browser close, or if the user just
navigated to another site.

your best option is to use a ticket system. when the user hits a page,
give
out a ticket (in a hidden field) and test for it on postback. allow only
one
active ticket per user. you can also timeout the ticket, and require a
new
login. if the user requests a new page, cancel the old ticket, and assign
a
new ticket. this handles the user closing the browser or navigating away
from yor site, then coming back.

-- bruce (sqlwork.com)
"anoj" <su********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
| Hi All
|
| i need to prevent multiple logins from the same user at the same time.
| what is the best way to do this .
|
| How can i detect if a user closes the browser window without logging
| out so tht his/her id can be removed from the global list maintained
| for the looged in users
|
|
| Kindly help
|
| Regards,
|
| Anoj Kumar
|

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: William Logan | last post by:
Hello all DBAs what is the best methodolgy to replace a server with a new server in a multiple sql server environment.. Is is using back up/restore to another/bridge type server then rename...
1
by: David McGeorge | last post by:
I am confused about windows account, win dimain account, sql login accoun and sql database user account.... can you give me a fresh example to show the exact relationship between them and how they...
2
by: Shashi | last post by:
My development environment is ASP.Net 1.1. When the user does multiple logins to the system and navigates to different screens and clicks back button sometimes it reading the session variables...
10
by: Conformix Sales | last post by:
Any thought about how can I stop a user from logging into the application multiple times. I am using forms authentication.
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
8
by: Christian Blackburn | last post by:
Hi Gang, I would like to have my application retain sessions even after the user closes their browser window, up unil the time the session is supposed to time out. Right now if the user closes...
6
by: Bhavini | last post by:
Hi All, I have to prevent multiple logins for the same user accessing at same time. i.e. if xyz user is active, no other login should be allowed for the same user ID. I thought of saving...
10
by: shankhar | last post by:
Hi all, In my project there is a requirement. If a user logged in at a time since he/she logged out others are not allowed to loggin using the same user name. That is to avoid multiple logins...
13
by: Samir Chouaieb | last post by:
Hello, I am trying to find a solution to a login mechanism for different domains on different servers with PHP5. I have one main domain with the user data and several other domains that need...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.