在asp.net中使用不同的浏览器选项卡进行登录 [英] Idenifying the login from different browser tab in asp.net

查看:83
本文介绍了在asp.net中使用不同的浏览器选项卡进行登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个登录选项asp.net的网站。



如果我在两个浏览器标签中打开网站并使用相同的用户帐户登录并导航到主屏幕两个选项卡,现在我从一个选项卡退出并再次登录到同一个选项卡,之后我点击了第二个选项卡,



我的疑问是我如何区别对待我从第一个标签或第二个标签发送请求来自后面的代码?



如果请求来自第二个标签我需要将应用程序导航到登录屏幕。如何我这样做?

I have a website with login option asp.net.

if i open website in two browser tabs and logged in with same user account and navigated to homescreen in both tabs , now i am logged out from one tab and again logged in same tab,after that i clicked on the second tab,

My doubt is how can i discriminate that i am sending request from first tab or second tab from code behind?

If the request is from second tab i need to navigate the application to login screen.How can i do this?

推荐答案

错误的想法。选项卡属于客户端的浏览器,而不属于您的站点或Web应用程序。从服务器端的角度来看,该选项卡与浏览器窗口没有区别。无论选项卡或窗口如何,登录都应该有效。顺便说一句,如果这种歧视是可能的,它可能会杀死你的登录功能。



-SA
Wrong idea. The tabs belong to the client's browser, not to your site or Web application. And the tab is no different from a browser window, from the server-side perspective. The login should work regardless of the tab or window. By the way, if such discrimination was possible, it could kill you login functionality.

—SA


特定浏览器中的选项卡将共享同一会话。因此,如果您在一个选项卡中注销,则应自动反映在另一个选项卡中。



这意味着,当您从一个选项卡注销并尝试如果您在代码中提到了处理会话的逻辑,那么在其他选项卡中执行某些操作会重定向到登录屏幕。无需来自哪个标签请求。你只需要检查会话是否存活。如果活着,那就做通常的事情,否则重定向。
Tabs in a particular browser will share the same session. So, if you are logged out in one tab, that should reflect automatically in the other tab.

That means, when you are logged out from one tab and trying to do something in other tab, that would redirect to the login screen, if you have mentioned that logic in your code to handle session out. No need to from which tab request is coming. You just need to check if session is alive or not. If alive, then do the usual thing, else redirect.


这篇关于在asp.net中使用不同的浏览器选项卡进行登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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