开发者

PAGE.USER missing in ASP.NET MVC?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜