在同一台计算机上没有多个登录,但允许相同的浏 [英] No Multiple Login on Same machine but same browser allowed

查看:88
本文介绍了在同一台计算机上没有多个登录,但允许相同的浏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个简单的要求,即不允许用户一次登录多个浏览器。同样的浏览器很好。



最简单的事情是什么?

Hi All,

I have a simple requirement of not allowing a user to log into multiple browsers at a time. Same browser is fine.

What is the simplest thing which can be done?

推荐答案

这令人惊讶地复杂:由于不同的浏览器不共享cookie(即IE不使用Chrome cookie,反之亦然),必须在服务器上完成,因为不同的浏览器也会有不同的会话,所以它必须与数据库相关。 />


我能想到的唯一方法是在登录时将客户端IP和会话ID存储在数据库中,并使用以下方法检查实时会话当他再次尝试时使用相同的IP。



此处有代码可以检索所有活动会话: http://stackoverflow.com/questions/1470334/list-all-active-asp-net-sessions [ ^ ],然后您可以查看一个cookie,看看它是否是同一个浏览器。
That''s surprisingly complicated: since different browsers do not share cookies (i.e. Chrome cookies are not used by IE and vice versa) it has to be done at the server, and since different browsers will also have different sessions, it has to be pretty much DB related.

The only way I can think of off the top of my head is to store the client IP and session ID in your DB when he logs in, and check for live session using the same IP when he tries again.

There is code here that will retrieve all active sessions: http://stackoverflow.com/questions/1470334/list-all-active-asp-net-sessions[^], you can then check a cookie to see if this is the same browser or not.


这篇关于在同一台计算机上没有多个登录,但允许相同的浏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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