我们如何在登录页面mvc5 aspdotnet中使用会话管理 [英] How we use session management in login page mvc5 aspdotnet
本文介绍了我们如何在登录页面mvc5 aspdotnet中使用会话管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
How we use session management in login page mvc5 aspdotnet
我尝试过:
What I have tried:
How we use session management in login page mvc5 aspdotnet
推荐答案
您始终可以使用User.Identity.GetUserId()
获取登录用户。如果字符串返回null或为空,则当前用户不会登录。如果您只是需要知道用户当前是否已登录,请使用User.Identity.IsAuthenticated
。
顺便说一下,由于几乎完全缺乏细节,你的问题有点糟糕。
You can always get the logged in user by usingUser.Identity.GetUserId()
. If the string comes back null or empty, the current user is not "logged in". If you simply need to know if the user is currently logged in, useUser.Identity.IsAuthenticated
.
BTW, your question kinda sucks due to an almost complete lack of detail.
这篇关于我们如何在登录页面mvc5 aspdotnet中使用会话管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文