对象(读取
HttpContext.Current.User.Identity.Name
Json字符串并反序列化为UserInfo对象)
public class Runtime
{
///
<summary>
///
当前登录用户相关信息
///
</summary>
public static UserInfo CurrentUser
{
get
{
if
(HttpContext.Current.Request.IsAuthenticated)
{
SysUser longinUser =
JsonConvert.DeserializeObject<UserInfo>(HttpContext.Current.User.Identity.Name);
if (string.IsNullOrEmpty(longinUser.LoginName))
{
return null;
}
else
{
return longinUser;
}
}
}
}
}
原文:http://www.cnblogs.com/gossip/p/3545709.html