I think Page开发者_如何学JAVA.User.Identity.IsAuthenticated is available in ASP.NET MVC, because I see other people talking about using it.
However, when I type Page., the intellisense gives me only these 3 options :
CreateHtmlTextWriterFromType Equals ReferenceEquals
What do you think is going on?
EDIT: If I do Page page = new Page()
, then page.User
works. Is it really needed?
You can access it in Controller :HttpContext.User.Identity.IsAuthenticated
You can acces it in view like this :<% if(User.Identity.IsAuthenticated){} %>
Hope this helps.
Page
is a Webforms object, not much help in MVC. You can access the authenticated user from the HTTP Context, something like httpcontext.user.identity
精彩评论