2015-05-29 36 views
0

我有一个带有登录屏幕的ASP.NET网站。它有各种级别的管理员,员工,客户端等登录。如何在Asp.net中监控网站登录

我的目标是监视登录。

Suppose if an employee logged in to the web app from one pc and tried to login for the same employee from another pc,i should able to monitor that by displaying a message saying that same employee logged in another pc and need to logout from the first login.

我怎样才能有效地实现这一目标?

回答

1

您可以在保存登录信息的表格中再添加一列。我们来命名这个新的列“Logged_PC_IP”。将登录的PC的IP地址存储在新列中。有关使用c检索本地IP地址的信息,请参阅此link

每次用户登录时,代码都必须检查登录表中的用户记录。修改文件后面的代码,在select语句中使用额外的和子句检查登录的ip。如果PC的IP和存储的IP不匹配,则可以在标签控件中显示错误消息。