简体   繁体   English

在多个浏览器选项卡中对用户进行身份验证

[英]Authentication of user in multiple browser tabs

I have been given a task to sort out a bug in a SilverLight application, however my knowledge of authentication is basic at best so I am quite stuck and looking for help. 我已经获得了一项任务,以解决SilverLight应用程序中的错误,但是我的身份认证知识充其量是基础知识,因此我很困惑并寻求帮助。

The issue is that if a user logs into the application, then opens another browser tab/window and accesses a URL from within the application, this is perfectly acceptable and the system works ok as far as we know. 问题是,如果用户登录到应用程序,然后打开另一个浏览器选项卡/窗口并从应用程序内部访问URL,这是完全可以接受的,并且据我们所知系统可以正常工作。 The problem arises when the user logs out of the application from one tab/window and then tries to continue to work on the other tab/window, in which case a variety of errors are thrown depending on what the user does. 当用户从一个选项卡/窗口退出应用程序,然后尝试继续在另一选项卡/窗口上工作时,就会出现问题,在这种情况下,根据用户的操作会抛出各种错误。

We already have a timer in the application to detect connection issues with the database so I thought that checking that the user is authenticated here would be a good start, so I checked for AuthenticationService.User.Identity.IsAuthenticated , but unfortunately that is always true. 我们的应用程序中已经有一个计时器来检测与数据库的连接问题,因此我认为在这里检查用户是否经过身份验证是一个好的开始,因此我检查了AuthenticationService.User.Identity.IsAuthenticated ,但不幸的是,这始终是正确的。 So I researched and debugged my code and that property is actually set to false once the Logout method has completed, however this doesn't seem to be the case when I debug the application once the user has logged out on the other tab/window. 因此,我研究并调试了代码,并且Logout方法完成后,该属性实际上设置为false,但是,当用户在另一个选项卡/窗口中注销后,调试应用程序时,情况似乎并非如此。

I have researched on the internet, but all the similar issues I can find are caused by something that isn't relevant, or that I don't understand completely. 我已经在互联网上进行了研究,但是我发现的所有类似问题都是由与您无关或完全不了解的问题引起的。

The system uses an authentication class which is inherited from FormsAuthentication , but all the Login and Logout functions use the base WCF RIA AuthenticationService service methods. 系统使用从FormsAuthentication继承的身份验证类,但是所有的LoginLogout函数都使用基本的WCF RIA AuthenticationService服务方法。

Could anyone make some suggestions as what could be the issue? 任何人都可以提出一些建议,因为这可能是问题所在吗?

When you log out basically what happens is that the server will destroy your session in the server memory/session state etc. If there is a new request from the same client the server will read the session id cookie and try to match it with one of the existing sessions. 基本上注销后,服务器将在服务器内存/会话状态等中破坏您的会话。如果来自同一客户端的新请求,服务器将读取会话ID cookie,并尝试将其与以下之一匹配现有的会话。 If this session will not be found then we will get the exception you are facing. 如果找不到该会话,那么我们将得到您面临的异常。

Having a SilverLight application this is basically a client application which will not send any request to the server until it really requires is ( Service call). 有了SilverLight应用程序,这基本上是一个客户端应用程序,除非真正需要,否则它将不向服务器发送任何请求(服务调用)。 I think you should send a log out message to all of your application instances to log out the user also on the client side everywhere else. 我认为您应该向所有应用程序实例发送注销消息,以便在其他任何地方的客户端也注销用户。

Maybe this links will help you 也许此链接将为您提供帮助

Can silverlight detect or communicate across browser instances? Silverlight可以跨浏览器实例检测或通信吗?

Writing a javascript file from another javascript 从另一个JavaScript编写一个JavaScript文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM