苏飞论坛
标题:
HttpContext.Current.User.Identity.Name
[打印本页]
作者:
羽毛
时间:
2013-5-22 10:11
标题:
HttpContext.Current.User.Identity.Name
今天看程序源码发现一些代码无法理解
public UserCache()
{
this.currentUser = HttpContext.Current.User.Identity.Name;
if (HttpContext.Current.Cache["AnyOffice_User_" + this.currentUser] == null)
{
this.UpdateUserName();
}
}
public UserCache(string userId)
{
this.currentUser = userId;
if (HttpContext.Current.Cache["AnyOffice_User_" + this.currentUser] == null)
{
this.UpdateUserName();
}
}
复制代码
第二个方法可以理解,将值存在HttpContext.Current.Cache 中用唯一的 KEY值去获取到信息,
可第一个方法怎么说,HttpContext.Current.User.Identity.Name 获取当前用户的名称,这不是在表示层,怎么能获取到当前用户的信息呢?
欢迎光临 苏飞论坛 (http://www.sufeinet.com/)
Powered by Discuz! X3.4