用户从其他设备登录时无法显示消息 [英] Not able to show message when user logged in from other device

查看:97
本文介绍了用户从其他设备登录时无法显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了用户从一台设备登录的功能。然后,如果他从其他设备登录,那么他将被注销并重定向到登录页面。



我通过会话完成了这项功能。当用户登录时,我在数据库中保存一个值,每次他转到其他页面我都匹配值(保存在数据库和会话中)如果它们不匹配(如果用户从其他设备登录,则数据库中的值将是更新后将与会话值不匹配)我将用户重定向到登录页面



问题是我无法显示消息(简单消息或弹出窗口) )当用户进入登录页面时。

请告诉我如何显示消息?



或告诉我这是否是我做的功能不好或者我必须通过javascript或任何其他资源使用其他方法



i想要在重定向到登录页面之前显示消息,就像用户登录时一样在其他设备上,他在以前的设备上显示了一条消息,你是从其他设备登录的,是吗?如果是,请让他登录,如果没有然后退出并重定向到登录页面。



基于我在我的问题中提到的功能。上面的功能可以做到吗?



我尝试过:



i尝试使用session来显示消息,但当用户进入登录页面时,会话显示空值并且登录页面上没有显示任何内容?

I have done the functionality of when user is logged in from one device. then if he logged in from other device then he will be logged out and redirect to login page.

I have done this functionality through a session. when user logged in I save a value in database and every time he go to other page i match the values (saved in database and in session both) if they dont match (if user is logged in from other device the value in database will be updated so will not match with the session value ) i redirect user to login page

the problem is I m not able to show message (simple message or popup ) when user go to loggin page.
kindly tell me how can i show message ?

or tell me if this functionality I have done is not good or I have to use some other method through javascript or any other resource

i want to show message before redirect to login page like when user logged in from other device he showed a message on previous device that u're logged in from other device is that you ? if Yes keep him logged in if No then loged out and redirect to login page.

based on the functionality i mentioned in my question. is the above functionality can be done ?

What I have tried:

i tried to use session to show message but when user go to login page that session show me empty value and nothing is shown on login page ?

推荐答案

首先,我不是ASP.NET专家,但是......



会话对象仅适用于当前客户端(设备)。如果您不允许用户在其他客户端(设备)上登录您的应用程序,则必须使用其他服务器端存储方式,例如:数据库。



请阅读: ASP.NET会话状态概述 [ ^ ]
First of all, i'm not an ASP.NET expert, but...

A session object is avaliable for current client (device) only. If you want to disallow user to log in into your application on another client (device), you have to use other means of server side storage, for example: a database.

Please, read this: ASP.NET Session State Overview[^]


这篇关于用户从其他设备登录时无法显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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