Click here to Skip to main content
11,642,855 members (73,609 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET session
I am want to use session manageent technique for User Login. When user login, his id will be store in session. but when he tries to login again from same browser or another broswer, it should not be allowed.
I know using sql it is possible but i want some technique other then sql.
thanks in advance.
Posted 12-Dec-12 19:54pm
choudhary.sumit at 13-Dec-12 2:03am
when submitting your login information:
<pre lang="c#">
Session["Username"] = txtusername.text;

//on login page on load event!

(Session["UserName"] != null)
Response.write("You are already logged in");
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is an application object, I believe, which contains data at the application scope. You can try something in there. The session is useless, because it's a different session for each browser, it can't tell that another session has the same user.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can do it by using global.asax file.
Please check Limit only one session per user in ASP.NET[^] for the codes.


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

  Print Answers RSS
0 DamithSL 258
1 Sergey Alexandrovich Kryukov 230
2 180
3 OriginalGriff 170
4 Afzaal Ahmad Zeeshan 155
0 Mika Wendelius 485
1 DamithSL 457
2 OriginalGriff 365
3 Afzaal Ahmad Zeeshan 258
4 Sergey Alexandrovich Kryukov 254

Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100