在ASP.Net中停止多个登录 [英] Stopping multiple logins in ASP.Net

查看:79
本文介绍了在ASP.Net中停止多个登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何考虑如何阻止用户多次登录应用程序

。我正在使用表单身份验证。

Any thought about how can I stop a user from logging into the application
multiple times. I am using forms authentication.

推荐答案

我想到了很多方法。将userIds放在arraylist中并在应用程序中存储

- 循环访问它并在有人登录时检查现有的
条目。使用a更新数据库用户表

field" isLoggedIn"并将其设置为true。


这些方法的问题是当他/她记录

时删除用户...它就是这样他们明确地退出了,但如果他们只是关闭他们的浏览器......你需要添加一个时间戳并定期清理它。


Karl


-

我的ASP.Net教程
http://www.openmymind.net/

" Conformix Sales" < SA *** @ conformix.com>在消息中写道

news:6C ***************** @ fe1.columbus.rr.com ...
Quite a few methods come to mind. put the userIds in an arraylist and store
that in the application - looping through it and checking for an existing
entry whenever someone logs in. Update your database user table with a
field "isLoggedIn" and set it to true.

The problem with these methods is removing the user when he/she logs
out...it''s simply if they explicitely log out, but if they simply close
their browser...you''d need to add a timestamp and clean it up routinely.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Conformix Sales" <sa***@conformix.com> wrote in message
news:6C*****************@fe1.columbus.rr.com...
有关如何阻止用户多次登录应用程序的想法。我正在使用表单身份验证。
Any thought about how can I stop a user from logging into the application
multiple times. I am using forms authentication.



如果我使用带有isLoggedIn的数据库表。字段并将其设置为true

用户登录,如何添加时间戳并定期清理它?


" Karl Seguin" < karl REMOVE @ REMOVE openmymind REMOVEMETOO。 ANDME net>

在消息新闻中写道:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
If I use a database table with a "isLoggedIn" field and set it to true on
user login, how do I add a timestamp and clean it up routinely?

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
想到了很多方法。将userIds放在一个arraylist中并在应用程序中存储
- 循环访问它并在有人登录时检查现有的
条目。用
更新数据库用户表字段isLoggedIn并将其设置为true。

这些方法的问题是当他/她记录
时删除用户...只是如果他们明确地注销,但是如果他们只需关闭他们的浏览器......你需要添加一个时间戳并定期清理它。

Karl

-
我的ASP.Net教程
http://www.openmymind.net/

" Conformix Sales" < SA *** @ conformix.com>在消息中写道
新闻:6C ***************** @ fe1.columbus.rr.com ...
Quite a few methods come to mind. put the userIds in an arraylist and
store
that in the application - looping through it and checking for an existing
entry whenever someone logs in. Update your database user table with a
field "isLoggedIn" and set it to true.

The problem with these methods is removing the user when he/she logs
out...it''s simply if they explicitely log out, but if they simply close
their browser...you''d need to add a timestamp and clean it up routinely.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Conformix Sales" <sa***@conformix.com> wrote in message
news:6C*****************@fe1.columbus.rr.com...
任何想法如何我可以阻止用户多次登录应用程序吗?我正在使用表单身份验证。
Any thought about how can I stop a user from logging into the application
multiple times. I am using forms authentication.




好吧,我要做的是添加第二个字段 lastLoggedIn"作为日期时间

并在将IsLoggedIn设置为true的同时将其设置为getDate()。


在接受用户登录之前,如果lastLoggedIn> 30分钟(对于

示例),我将isLoggedIn设置为false

然后我只接受来自'isLoggedIn'的人的登录是错误的


你可以做得更好,并为每个

页面点击更新lastLoggedIn字段...这样可以让你更敏感...你可以改变

最长登录时间为5-10分钟......取决于应用程序的类型

你有多少以及你希望用户有多少次点击新页面。
< br $>
Karl

-

我的ASP.Net教程
http://www.openmymind.net/

" Leon" < VN ***** @ msn.com>在消息中写道

news:ut ************** @ TK2MSFTNGP09.phx.gbl ...
Well, what I would do is add a second field "lastLoggedIn" as a datetime
and set it to getDate() at the same time you set the IsLoggedIn to true.

Before accepting a login from a user, if lastLoggedIn > 30 minutes (for
example), I would set isLoggedIn to false
then I would only accept logins from people who''s isLoggedIn is false

You could make it even better and update the lastLoggedIn field for every
page hit...this would let you be far more responsive...you could change the
maximum login time to 5-10 minutes...depending on what type of application
you have and how often you expect users to hit a new page..

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Leon" <vn*****@msn.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
如果我使用数据库具有isLoggedIn的表格字段并在
用户登录时将其设置为true,如何添加时间戳并定期清理它?

  Karl Seguin" < karl REMOVE @ REMOVE openmymind REMOVEMETOO。 ANDME net>
在消息新闻中写道:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
If I use a database table with a "isLoggedIn" field and set it to true on
user login, how do I add a timestamp and clean it up routinely?

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
相当多我想到了一些方法。将userIds放在一个arraylist中并在应用程序中存储
- 循环访问它并在有人登录时检查
现有条目。用
更新数据库用户表字段isLoggedIn并将其设置为true。

这些方法的问题是当他/她记录
时删除用户...只是如果他们明确地注销,但是如果他们只需关闭他们的浏览器......你需要添加一个时间戳并定期清理它。

Karl

-
我的ASP.Net教程
http://www.openmymind.net/

" Conformix Sales" < SA *** @ conformix.com>在消息中写道
新闻:6C ***************** @ fe1.columbus.rr.com ...
Quite a few methods come to mind. put the userIds in an arraylist and
store
that in the application - looping through it and checking for an existing entry whenever someone logs in. Update your database user table with a
field "isLoggedIn" and set it to true.

The problem with these methods is removing the user when he/she logs
out...it''s simply if they explicitely log out, but if they simply close
their browser...you''d need to add a timestamp and clean it up routinely.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Conformix Sales" <sa***@conformix.com> wrote in message
news:6C*****************@fe1.columbus.rr.com...
任何想法如何我可以阻止用户多次登录
应用程序。我正在使用表单身份验证。
Any thought about how can I stop a user from logging into the application multiple times. I am using forms authentication.





这篇关于在ASP.Net中停止多个登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆