Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi
If am trying to create a web application in which multiuser can access this web application through URL which is hosted on one server.If one user logged on this application from one browser or machine this user should not allow to login from any other browser or machine.
 
i want to similar to bank application which restrict to user create single instance at a time.
I know that i can do this by updating flag in database table after login successfully and check every time where user already logged or not checked but it increases my database round trip.i thinking application object can useful in this case but don't know how to implement.provide soln.thanx
Posted 2-Oct-12 20:17pm
Edited 2-Oct-12 20:34pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
I have solved my problem by using application variable which contain list of userIds as string.I am setting this application varible to blank when the application is started in Global.asax.After this userIds append in this string for every user login.For every login, userid enter by user is cheked in this application variable and if found error msg is display other wise other validation done for successful login.When user logged out or close the application userId from that string removed.
  Permalink  
Comments
aspnet_regiis -i at 5-Nov-12 0:51am
   
How are you clearing the userId from the list when user closes the browser ? I bet you cannot do it...
Sanjeev Alamuri at 5-Nov-12 1:12am
   
Vijay Walunj, will post your code here. it might helpful for me. thanks and regards, Sanjeev
Vijay Walunj,Navi mumbai at 5-Nov-12 5:01am
   
I am successfully run it on internet explorer 9.I am trying to work it in all browsers. I am calling javascript function on "onbeforeunload " function of page.When i am closing this page it fires this event and called javscript function.In this function i am checking for clientX and clientY values to ensure that page is unload due to closing browser. My code: if ((window.event.clientX < 0) || (window.event.clientY < 0) || (window.event.clientX < -80)) { redirecting page to aspx page where i am handling application variable.Also clearing the session. } In this page I am assigning the application variable to one string varible and then converting it to the array and matching the userId and then removing from it and again convert it to the string and assign it to the application variable. Try it will works.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try these links
 
Link1[^]
Link2[^]
Link3[^]
 
Hope above links would have solve your problem !!!!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You should nob bother about this roundtrip, since you need to do this only at login, not on every request. Storing such data in the server's memory could slightly increase performance at that point, but can be a huge overhead in matter of resources. Of course, if you have your database remotely, you can make a local database with just these information (you don't need a server for that). In such complex cases session handling should not be inprocess, thus you will need an other alternative for storing sessions. This can be the same local database. And here you have a common goal: both the sessions and the single instance logon are in the same scope. Of course, you can use other appliances to store session data, I suppose those can be also convinced to get queried for already logged-on users. But be aware to set a proper session timeout, or your users will be faced with long lockouts.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 808
1 OriginalGriff 493
2 sanket saxena 329
3 Tadit Dash 315
4 Peter Leow 228
0 Sergey Alexandrovich Kryukov 11,990
1 OriginalGriff 7,349
2 Peter Leow 5,003
3 Abhinav S 4,003
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid