如何从会话获取登录用户 [英] How to Get loggedin user from session
本文介绍了如何从会话获取登录用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
您能帮我从Session中获取Logggedinuser(用户名)吗?
问候
Lancy
Hi
Could you please help me to get Logggedinuser(username)from Session.
Regards
Lancy
推荐答案
会话值本身不会生成,如果将其保留在会话中,则只能检索它.
这可能会有所帮助,
http://msdn.microsoft.com/en-us/library/aa287606 (v = vs.71).aspx [
Session value is not something which gets generated itself, if you kept it in session then only you will be able to retrieve it.
This may help,
http://msdn.microsoft.com/en-us/library/aa287606(v=vs.71).aspx[^]
问问题时请更具体.
您尝试了什么?至少提供一些代码段,以便我们找出错误所在.
假设您正在编写自己的代码来验证用户凭据,
在检查凭据是否有效之后,请通过
将相应的用户名放在会话中
Hi,
Please be more specific while asking a question.
What you have tried ? Provide at-least some code snippet so that we can figure out where you are making a mistake.
Assuming you are writing your own code to validate the user credentials,
after checking the credentials if they are valid please place the corresponding username in session by
session["name"]=username(may be username textbox.text)
您想在任何地方访问它的地方
wherever you wanna access it
if(session["name"]!=null)
{
lblUsername(your label name).text=session["name"].toString();
}
希望这会有所帮助
问候
斯里曼
Hope this helps
Regards
Sriman
这篇关于如何从会话获取登录用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文