如何从SessionID变量获取用户名 [英] How to get UserName from SessionID variable
本文介绍了如何从SessionID变量获取用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从SessionID变量获取用户名
How to get UserName from SessionID variable
推荐答案
尝试一下
if (HttpContext.Current.User != null)
{
strName = HttpContext.Current.User.Identity.Name.ToString();
}
详细信息请参见
http://msdn.microsoft.com/en-us/library/system. web.httpcontext.user.aspx [ ^ ]
Details refer
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user.aspx[^]
只要看到此链接可能会对您有所帮助
http://blog.scrappydog.com/2008/06/determining-your-terminal- server.html [^ ]
http://www.developerfusion.com/code/2645/how-to -get-the-current-sessionid/ [
Just see this link might help you
http://blog.scrappydog.com/2008/06/determining-your-terminal-server.html[^]
http://www.developerfusion.com/code/2645/how-to-get-the-current-sessionid/[^]
常规:
从第1页开始:
general:
from page1:
Session["em"] = TextBox1.Text.ToString();
textbox1的用户名来自第1页.
来自第2页:
textbox1 has the user name from page 1.
from page2:
string text2 = (String)Session["em"];
这篇关于如何从SessionID变量获取用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文