MVC 3 ASP.NET Roles-Authorize Attribute
I am getting user roles from Active Directory and I am binding the same roles to ASP.NET Membership Roles.
I want to control the disp开发者_运维问答lay for the various Views in Controller by using
[Authorize(roles="Admin")]
But Which ever role I specify, The View just doesn't display. If I take out the [Authorize(roles="Admin")]
it works.
Does Authorize uses ASP.NET Membership roles? if so, Why I am getting this error?
Am I missing anything? Any Ideas?
Thank you
IIRC if you use AD roles it works with groups and you need to specify the domain:
[Authorize(Roles = @"MYDOMAIN\SomeDomainGroup")]
Now if the user accessing the site belongs on the given AD group he will be granted access.
Assuming you are using the VS built in server and you are getting a blank page - the built in development server will display a blank page instead of prompting for credentials.
Buried way down in a note on this page
Note:
If you are using the Visual Studio Development server, you are not prompted for credentials and you see only a blank page.
精彩评论