Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 2-Oct-12 20:34pm
v2

Try these links

Link1[^]
Link2[^]
Link3[^]

Hope above links would have solve your problem !!!!
 
Share this answer
 
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.
 
Share this answer
 
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.
 
Share this answer
 
Comments
bbirajdar 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,
Sanjeev
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.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900