开发者

ASP.NET User.IsInRole clarification

I need to implement authorisation based on Active Directory group. Could someone please clarify how the code below works?

User.IsInRole("Human Resouces")

Question:

  1. Is role "Human Resources" checked against Active direc开发者_开发百科tory group?
  2. If not, how do I enable so that isInRole actually checks the Member Group in Active directory.
  3. Or does it check against role on IIS Server machine?

Thank you.


This requires some setup, check out these following resources:

http://msdn.microsoft.com/en-us/library/ms180890(v=vs.80).aspx http://msdn.microsoft.com/en-us/library/ff650308.aspx

If you follow the approach of defining a principal that sets the principal to the User property, you can use User.IsInRole to check the AD authorization store. The User (an IPrincipal) represents the information from the authentication mode setting (either forms or windows); AD is typically setup through forms authentication.

HTH.


I think you should look at this MSDN post it explain the things as your requirements are.
How To: Use Windows Authentication in ASP.NET 2.0

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜