I'm using Forms authentication on my MVC website. I administrate users and roles using the default ASP.NET Configuration option in Visual Studio. All good so far.
I can successfully do Page.User.IsInRole("Moderator")
in a View. True
is returned as expected.
However when calling Context.User.IsInRole("Moderator")
inside Global.asax's Application_PostAuthenticateRequest()
(or any later event during the cycle, for the matter..) False
is returned.
What is the difference between Page.User
and Context.User
? And how can I get the same (expected) results inside Global.asax?