Questions tagged [principalcontext]

PrincipalContext class is part of the Microsoft .NET System Directory Services Account Management API. It encapsulates a server or a domain against which operations are performed. It is also used disambiguate the generic deprecated tag [tag:context].

PrincipalContext class is part of the Microsoft .NET System Directory Services Account Management API. It encapsulates a server or a domain against which operations are performed.

References

See the main documentation of this Class in in the MSDN library.

137 questions
1
vote
1 answer

System.DirectoryServices.AccountManagement and error messages from LDAP vs LDAPS

I have some C# code using System.DirectoryServices.AccountManagement that is used to allow a user to change their Active Directory user account password. It is currently using LDAP (:389) and I wanted to switch it to LDAPS (:636) for security…
bkr
  • 1,444
  • 1
  • 11
  • 22
1
vote
0 answers

Can not retrieve one particular group users in Active Directory using PrincipalContext

Getting exception system.directoryservices.accountmanagement.principaloperationexception : There is no such object on the server Trying to get all members of a group. Getting exception with one particular group only, able to get members of other…
1
vote
0 answers

System.DirectoryServices PrincipalContext with read only domain controller

I have an application which has certain functionality secured by performing an Active Directory lookup via DirectoryServices. I am in the midst of migrating this code from a web host in our old domain to a new domain. The code worked flawlessly on…
Gary
  • 199
  • 5
  • 12
1
vote
0 answers

Configuring ActiveDirectory Group Security with C# using directory services

I'm trying to create an app to configure a fresh install of AD or reset an AD to default values. This means using the DirectoryServices API. My plan is to create some OU's, then some Groups (each with their own security poperties - ForeFront and CA…
1
vote
0 answers

Get user groups call to LDAP server gets "The server is not operational" because the server called changes

I'm trying to get the groups for a user from an ADAM server using: PrincipalContext yourDomain = new PrincipalContext(ContextType.ApplicationDirectory, principalContextName, …
Cenas
  • 116
  • 1
  • 6
1
vote
0 answers

Constructing Extended User Principal without explicit Principal Context of domain

Recently I've been implementing custom ExtendedUserPrincipal class similar to sample here. The only problem for me is to construct new instance based on existing instance of base class (e.g. UserPrincipal.Current), to map existing user principal to…
Aloraman
  • 1,389
  • 1
  • 21
  • 32
1
vote
2 answers

How can i get all groups of a local user using ObjectQuery?

i try to display all groups a special User is in. I also know, that i could do it like this: public static List getUsers(){ PrincipalContext context = new PrincipalContext(ContextType.Machine, "computername"); …
1
vote
1 answer

C# ,Authentication against active directory

I am using PrincipalContext (from the System.DirectoryServices.AccountManagement namespace) for authentication in my application against Active Directory (I am using the ValidateCredentials function). The authentication works fine, when I am…
1
vote
1 answer

Problems with extending s.ds.am.UserPrincipal class

I have been trying to extend the s.ds.am.UserPrincipal class in VS 2010 VB app as I require access to AD User properties that are not by default a part of the UserPrincipal. This is a new concept to me and I have found some useful code on here as…
1
vote
1 answer

Spring: SecurityContextHolder.getContext().getAuthentication().getPrincipal() returns null

In My MVC application, even after login when I am trying to get the principal object using, Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); the authentication is returned as null. In Spring-security…
Poppy
  • 2,902
  • 14
  • 51
  • 75
1
vote
2 answers

How to find a user from another forest with UserPrincipal.FindByIdentity?

Here is some sample code: var ctx = new PrincipalContext(ContextType.Domain); var up1 = AuthenticablePrincipal.FindByIdentity(ctx, IdentityType.Sid, "S-1-5-21-......."); var up2 = AuthenticablePrincipal.FindByIdentity(ctx,…
fejesjoco
  • 11,763
  • 3
  • 35
  • 65
1
vote
1 answer

Using PrincipalContext to ValidateCredentials fails with right password after sending many wrong passwords

using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domainName)) { isWindowsAutenticated = pc.ValidateCredentials(username, password); } If pass to this code many wrong passwords for a user, then pass in the right password, it…
TheWommies
  • 4,922
  • 11
  • 61
  • 79
1
vote
1 answer

asp.net mvc slow response every 45 seconds

I have an MVC 4 app which is performing a slow request roughly every 45 seconds. It's normally 200ms and all requests will be 200ms for about 45 seconds before there is one for about 4500ms. Then back to 200ms. I have no caching set up. I am…
big_tommy_7bb
  • 1,257
  • 2
  • 21
  • 37
1
vote
1 answer

How to include multiple OU from AD account in a single search using PrincipleSearcher in asp.net c#

Scenario: Active Directory username search should return results against a search item (i.e. Firstname or Surname). There are 6 countries that are setup as different organizational units for AD accounts. e.g. UK (OU= UK), France (OU = FR). Now user…
PineCone
  • 2,193
  • 12
  • 37
  • 78
1
vote
1 answer

UserPrincipal.FindByIdentity error in Firefox

I have a method to retrieve a list of AD groups that a user belongs to. Here is the code: public static List GetGroups(string userName) { List result = new List(); //…
user2701646
  • 139
  • 4
  • 4
  • 20