1
Reply

C# current.principal

Sie Ste

Sie Ste

11 years ago
1.7k

In a current C# 2008 application, the current logic determines if a user has access to certain roles by using the following kind of check:
IPrincipal ip = Thread.CurrentPrincipal;
bool isInRole = ip.IsInRole("managers");

Now my company is going to use several different domains. For the logic
I listed above, would I need to use logic like
 if (ip.IsInRole("domainname1/managers") || 
    ip.IsInRole("domainname2/managers") ||
    ip.IsInRole("domainname3/managers"))

,can I use logic that does not require the domain name, or do you have a suggestion on what I can try?
 Thus can you show me in code or tell me how to accomplish my goal?


Answers (1)