473,387 Members | 1,528 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,387 software developers and data experts.

how to prevent multiple login for same user in asp.net

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
Jun 19 '10 #1
4 10951
ThatThatGuy
449 Expert 256MB
@visweswaran2830
Its a bit impossible to control it without a database...

If you want to prevent same login from multiple places..
it can only be done through a flag in the database saying user's logged in..
Jun 19 '10 #2
Frinavale
9,735 Expert Mod 8TB
This answer will depend on how you implement the login component of your application.

Most of the time the login is associated with the browser that the user is working with. This means that a user can login using one browser and a cookie is set (whether it be a Session Identifier cookie, or a cookie that contains authentication ticket). Cookies set for one web browser (say Internet Explorer) are not available in another web browser (say FireFox).

So, in your server side code it's not enough to simply check the user's Session, or the authentication cookie...

You're going to have to store something server side that checks if the userID is "logged in".

You could consider using Cache to store the user's ID when the log in... when the user logs in, add the user's name into Cache...so that you can check to see if the user is already logged in whenever a user attempts to login. You can set Cache entries to time out after a while too...so that if the user forgets to log out they wouldn't be locked out of the system forever.

You could also set a application variable...or you could even use an XML file if you don't want to use a database.

There are a lot of ways to implement such a solution.

-Frinny
Jun 21 '10 #3
Kiti
1
Hi Frinny,
I liked your post. I am beginner in .net and want to implement the same functionality in my application using C#. Can you please send me a sample code for what you mentioned above?

Thanks a lot in advance.

Kiti
Jun 8 '11 #4
Frinavale
9,735 Expert Mod 8TB
I don't really have any sample code.
If you do not have a database for your users then you can use the web config.

Maybe you should start by reading this MSDN article on Forms Authentication Explained.

-Frinny
Jun 8 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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...
1
by: Karthik | last post by:
Hi, I have a website running on ASP.Net on IIS 6.0. This website has more than 10000 users login everyday. At times the users login with the same user name and password more than once at the...
3
by: Tom | last post by:
Hi I have a web application using asp.net and c#. User has to login to the application with his username and pwd. However, I do not allow other user uses the same username and pwd to login, i.e....
2
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...
6
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...
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...
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
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
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,...
0
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...

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.