资 源 简 介
Asp.net中实现同一用户名不能同时登陆(单点登陆)
Web项目中经常遇到的问题就是同一用户名多次登陆的问题,相应的解决办法也很多,总结起来不外乎这几种解决办法:将登陆后的用户名放到数据库表中;登陆后的用户名放到Session中;登陆后的用户名放到Application中;登陆后的用户名放到Cache中。一般的这几种方法都是登陆了之后,如果没有正常退出,第二次登陆将不被允许。这样一般都会存在一个问题:如果用户没有正常退出系统,那么他接下来继续登陆的时候,因为Session没有过期等问题,会被拒绝继续登陆系统,只能等待Session过期后才能登陆。本文介绍的方法是采用类似于MSN登陆的方法,第二次登陆时会把第一次的登陆注销掉,第一次登陆将会类似于MSN弹出:您的帐号已在别处被登陆,您被强迫下线的提示信息。
功能实现起来也比较简单:
登陆用户名密码验证通过之后输入以下代码:
-Page_Separating achieve the same user name can not landing (single-point landing) Web projects often encountered The problem is the same user name repeatedly landing problems, the corresponding solutions are many, This sum up no more than several solutions : After landing the user into database tables; After making landfall, the user into Session; After making landfall, the user into Application; After making landfall, the user into Cache. General these methods are after landing, in the absence of normal withdrawal, the second landing would not be allowed. This will usually there"s