HttpContext.Current.User 和 Page.User有区别吗?

解决方案 »

  1.   

    An IPrincipal object represents the security context of the user on whose behalf the code is running, including that user's identity and any roles to which they belong.This property uses the HttpContext object's User property to determine where the request originates.
      

  2.   

    《关于上下文》http://www.lemongtree.net/Tech/Prog/2004/157.htm
      

  3.   

    HttpContext.Current.User为当前 HTTP 请求获取或设置安全信息
    Page.User 属性来获得与正在请求页的用户有关的身份验证信息
    也不知道有什么不同,没有实践过
      

  4.   

    正向 HttpContext.Current.cache 和  page.cache 的关系一样!
     HttpContext.Current.session HttpContext.Current.viewstate
      

  5.   

    这个问题我已经找到线索了,
    其实这两个对象指向的都是IPrincipal对象,只不过使用HttpContext可以对principle对象进行设置,但是使用Page就只能读。可能是考虑到在Page中用的时候不需要设置的缘故吧。