473,687 Members | 3,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prevent Multiple login in ASP.NET

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 active falg in databse. but when user closes browser or
anyhow regular logoff procedure is not called then that user will always be
in active state. So next time he will not be allowed to login.

Even Session_end() event will not occur if user will close the borwser.

Please help me if anyone has come accross the same problem.

Thanks
Bhavini
Nov 28 '06 #1
6 6199
Use the application cache with a sliding expiry of 5 minutes. At least this
way your user will be locked out for a maximum of 5 minutes. Additionally
I'd allow a duplicate login if it came from the same IP address.
Nov 28 '06 #2
Instead of preventing a 2nd login, just terminate the first one.
Nov 28 '06 #3
You could put a small hidden IFRAME in the page and when the window.unload
function occurs on the client, set the location to a page with undoes the
flag. Then on each page load redo it. It leaves you open to multiple logins
for a very small window but should catch when they close the browser.

I havent tried this myself as I normally talk people out of this requirement
when I tell them how much money will be spent or it.

--

Ciaran O''Donnell
http://wannabedeveloper.space.live.com
"Bhavini" wrote:
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 active falg in databse. but when user closes browser or
anyhow regular logoff procedure is not called then that user will always be
in active state. So next time he will not be allowed to login.

Even Session_end() event will not occur if user will close the borwser.

Please help me if anyone has come accross the same problem.

Thanks
Bhavini
Nov 28 '06 #4
"Bhavini" <Bh*****@discus sions.microsoft .comwrote in message
news:A2******** *************** ***********@mic rosoft.com...
Even Session_end() event will not occur if user will close the borwser.
Yes it will, just not straightaway. The session will eventually time out
automatically according to the Timeout setting (20 minutes by default)
whereupon the Session_End() event will fire.
Nov 28 '06 #5
Thx for the reply.

But actually we are having webfarm scenario, so I dont think it will be
possible to use caching here. And another thing is, we cant bear the delay of
5 minutes. We should be able to login immediately once browser is closed.

Two scenarios I have in my mind
1) if we can catch browser close event and call logout process there. But I
am not sure how to catch browser close event.

2) In DB we can maintain Active/Inactive flag as well as SessionID for
partucular user. So when the same user is logging we can check that
particualr session is activ or not based on session ID. I guess session ID
should be unique.

"Peter Morris [Droopy eyes software]" wrote:
Use the application cache with a sliding expiry of 5 minutes. At least this
way your user will be locked out for a maximum of 5 minutes. Additionally
I'd allow a duplicate login if it came from the same IP address.
Nov 29 '06 #6
It is a bit pricey, but ScaleOut StateServer supports this
quite well. I love the ability to share session variables
across servers and across app domains across servers.

Very powerful.

http://www.eggheadcafe.com/articles/scaleout_server.asp

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp

"Bhavini" <Bh*****@discus sions.microsoft .comwrote in message
news:1E******** *************** ***********@mic rosoft.com...
Thx for the reply.

But actually we are having webfarm scenario, so I dont think it will be
possible to use caching here. And another thing is, we cant bear the delay
of
5 minutes. We should be able to login immediately once browser is closed.

Two scenarios I have in my mind
1) if we can catch browser close event and call logout process there. But
I
am not sure how to catch browser close event.

2) In DB we can maintain Active/Inactive flag as well as SessionID for
partucular user. So when the same user is logging we can check that
particualr session is activ or not based on session ID. I guess session ID
should be unique.

"Peter Morris [Droopy eyes software]" wrote:
>Use the application cache with a sliding expiry of 5 minutes. At least
this
way your user will be locked out for a maximum of 5 minutes.
Additionally
I'd allow a duplicate login if it came from the same IP address.
Nov 30 '06 #7

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

Similar topics

1
2687
by: Job Lot | last post by:
How can I prevent multiple instances of MdiChild form? I have a MdiParent form with a DataGrid showing all the clients in the database. User clicks on a row to open MdiChild form which display details of the client. User can have multiple clients open at the same time, but how can I prevent them from opening multiple instances of the client?
4
12243
by: logicalfeline | last post by:
How do you prevent multiple instances of a program from running? Cat
2
4660
by: James X. Li | last post by:
Is there a way to implement multiple login forms for ASP.NET applications? With our application we want to implement simple login form for normal resources (downloadable files), but more rigorous login forms for tasks like administration and configuration. The current ASP.NET seems only to allow to a single login form via the authentication element in web.config in the root directory. One work-around for our problem is implementing a...
6
4373
by: anoj | last post by:
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
18
3388
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 relies on subscrption fees. Sessions ID's are matched between the browser and the server. So a users can login with same username and password and those sessions are tracked individually. Some suggest create table fields with the session ID...
3
1912
by: Aliriazi | last post by:
All, I have created a simple database, which includes a receiving table and outgoing table in my receiving table I have a multiple entry of the same fields. I am trying to create a query that contains receiving table, which is adding the quantity of the same field and minus the outgoing table. The question I have is how can I prevent multiple copies of the same field in my inventory query. Many thanks, Al.
10
13073
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 using a account. How to do this? I had got a idea and implemented. 1. When a user logs in storing the username, ip, login time to db.
1
2085
by: alexseow | last post by:
How to prevent double login with same account? , hv any ideas? thanks
4
11085
by: visweswaran2830 | last post by:
Hi, I want to prevent multiple user login for same user in asp.net.. How can I achieve. Note: I want to control without database concepts
0
8590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8524
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9066
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7617
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4321
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4541
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2214
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1947
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.