Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET session
Hi,
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 20:54pm
Comments
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");
}</pre>
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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.
 
Thanks...

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

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 PIEBALDconsult 150
3 BillWoodruff 148
4 Jochen Arndt 135
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2014
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