开发者

ASP.NET User.IsInRole clarification

开发者 https://www.devze.com 2023-03-08 12:46 出处:网络
I need to implement authorisation based on Active Directory group. Could someone please clarify how the code below works?

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

精彩评论

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