Click here to Skip to main content
13,195,026 members (88,107 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 2-Oct-12 20:34pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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.
aspnet_regiis -i 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 5-Nov-12 1:12am
Vijay Walunj, will post your code here. it might helpful for me.
thanks and regards,
Vijay Walunj,Navi mumbai 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
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try these links


Hope above links would have solve your problem !!!!

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 |
Web02 | 2.8.171018.2 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2017
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