xiangxiaoxixi
xiangxiaoxixi
2016-04-07 01:51

用moq给httpcontext赋值

20
  • httpcontext赋值
  • moq

public static VMERPUser Me
{
get
{
FormsIdentity userIdentity = HttpContext.Current.User.Identity as FormsIdentity;
if (userIdentity != null)
{
FormsAuthenticationTicket ticket = userIdentity.Ticket;
return JsonConvert.DeserializeObject(ticket.UserData);
}
return null;
}
}
让我能够通过这个方法得到值。不会报错。求moq给httpcontext赋值的例子

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答

为你推荐