Click here to Skip to main content
11,930,222 members (40,518 online)
Rate this:
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 20:54pm
choudhary.sumit 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.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