Custom Identity using MVC5 and OWIN

后端 未结 4 1820
轻奢々
轻奢々 2021-01-30 11:33

I trying to add custom properties to the ApplicationUser for a web site using MVC5 and OWIN authentication. I\'ve read https://stackoverflow.com/a/10524305/264607 and I like ho

4条回答
  •  孤城傲影
    2021-01-30 12:26

    I bet HttpContext.Current.User is null. So instead of this:

    if (HttpContext.Current.User.Identity.IsAuthenticated)
    

    you can try this:

    if (HttpContext.Current.Request.IsAuthenticated)
    

提交回复
热议问题