本文介绍了如何防止同一用户从两个不同的浏览器登录到asp.net网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

In my asp.net website, I want to prevent same user login into website simultaneously from two different browsers. In order to do so, I had created table (say userloggedin)  that will store user id and time once user login. when user attempts to login from different browser, user will not be redirected into website from that new browser he is attempting to login (if user's record is in userloggedin table). 

User's record will be deleted when user logout, thus clearing log for allowing next time login.

The problem i am facing using this approach is when user clicks on close button from title bar, browser closes. Here, record will not be deleted from userloggedin table.( i need to delete from this table to allow future login). I had used window.onbeforeunload and kept a code to delete from userloggedin in here. But this function gets fired on every postback. 

How can i delete record from userloggedin table on click of close button? Any alternative approach is welcome..





我有什么试过:



我创建了一个用户登录表来存储登录用户的记录。然后,当用户从另一个浏览器登录时,会检查该表。如果此表中有他的数据,则不允许他登录。



What I have tried:

I had created a table userloggedin to store record of user logged in. Then, when user login from another browser, this table is checked. If there is his data in this table, he is not allowed to login.

推荐答案



这篇关于如何防止同一用户从两个不同的浏览器登录到asp.net网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 16:43