Questions tagged [userprincipal]

Encapsulates and exposes some principals or constructors of the active directory userprincipal class.

Encapsulates and exposes some principals or constructors of the active directory userprincipal class.

Link: UserPrincipal Methods

170 questions
6
votes
6 answers

Memory Leak when using PrincipalSearcher.FindAll()

I too have a long running service using plugins and appdomains and am having a memory leak due to using directoryservices. Note that I am using system.directoryservices.accountmanagement but it is my understanding that it uses the same underlying…
Richard
  • 286
  • 3
  • 9
5
votes
3 answers

Confused with C# 'using'

I have seen some code for working with AD in this stackoverflow question I am getting confused about the using statement. I thought that it was just used for things that you are worried could become memory leak, like a WebClient, or…
baron
  • 11,011
  • 20
  • 54
  • 88
5
votes
1 answer

UserPrincipal.Current throws COMException from one day to the next

This morning I started noticing some problems with several of my programs regarding Active Directory read operations. I noticed that all those applications (client and server) use the System.DirectoryServices.AccountManagement.UserPrincipal class…
Florian-Rh
  • 777
  • 8
  • 26
5
votes
2 answers

C# Add User to Active Directory - The attribute syntax specified to the directory service is invalid

I am having an issue when attempting to create a new user in active directory. I followed the steps provided in this link for using PrincipalContext (with the exception that I am only doing one user at a time when they are hired and entered into the…
Red_Phoenix
  • 482
  • 6
  • 22
4
votes
1 answer

The LDAP Server is Unavailable using PrincipalContext and ADLDS

We are making use of ADLDS for our user management and authentication. We can successfully query the instance without problems. However, trying to perform an operation such as SetPassword will fail or even trying to create a new user if a password…
Scott
  • 729
  • 1
  • 11
  • 30
4
votes
0 answers

Get WindowsPrincipal from UserPrincipal

The goal I'm writing a class that abstracts various Windows user mechanics. My class knows about the user's account name and domain, if any. I am trying to hydrate a property that indicates whether the user has administrative privilege on either the…
AdamStone
  • 138
  • 1
  • 8
4
votes
1 answer

Why does "request.getUserPrincipal().getName()" sometimes return a blank string?

Has somebody an idea, why the getName() method of the UserPrincipal sometimes provides an empty String? Most of the time it returns the correct user name but not every time. This behaviour does occur randomly. I can start the application, run the…
Marcus
  • 1,105
  • 2
  • 21
  • 35
4
votes
2 answers

How to get Roles from UserPrincipal in Java?

I created a class(Named as CustomRequestWrapper) which is implementing HttpServletRequestWrapper .In CustomRequestWrapper class i am setting user principal.Now in my code i want to get list of roles from the user principal.I tried to use…
Nadendla
  • 712
  • 2
  • 7
  • 17
4
votes
0 answers

AccessDenied while using UserPrincipal SetPassword method

I am getting an AccessDenied exception while changing user's password using UserPrincipal class. I am logging to an Asp.Net application through Windows Authentication (domain user). If I try to change other user's password I am getting the access…
4
votes
0 answers

PrincipalOperationException 1355 but WireShark indicates success

I have an application that performs a UserPrincipal (and GroupPrincipal) FindByIdentityWithType outside the applications domain. This worked until last week. Since then I installed Visual Studio 2012 on my development machine and my code stopped…
MoCapitan
  • 439
  • 4
  • 9
4
votes
3 answers

Using UserPrincipal to check if local admin

I am trying to have a method that takes in a username and will return true if that user is a local administrator (not on the entire domain, just the local machine) and false otherwise. I've tried to change the technique found at In .NET/C# test if…
Sterling
  • 3,835
  • 14
  • 48
  • 73
4
votes
1 answer

ASP.NET MVC Windows Authentiaction and DirectoryServices - Get Mail Address of the current user throws an InvalidCastException

I am using ASP.NET MVC 4 and Windows Authentication. When I am using VisualStudio everything works fine, but when I deploy my site an exception is thrown. var emailAddress = UserPrincipal.Current.EmailAddress; throws: Unable to cast object of…
Rookian
  • 19,841
  • 28
  • 110
  • 180
4
votes
2 answers

Getting members of an AD group where result type is a custom derived UserPrincipal

I've created my own derived UserPrincipal-type which is used to get some extended AD properties. This works fine. Now I'm looking for a way to use the GetMembers() method of the groupprincipal object to return me a list of my custom UserPrincipal…
Stefaan
  • 481
  • 4
  • 11
3
votes
1 answer

Prevent subcontainer objects in PrincipalSearcher Query C#

How can I prevent subcontainer objects in queries to a specific OU with subcontainers (child OU)? To clarify, I don't want to include user objects in children OUs (subcontainers) in the result set. Given something like the code on another…
victor_c
  • 171
  • 2
  • 10
3
votes
1 answer

Cannot grant permission to EventBridge bus

I am creating a custom bus in AWS EventBridge via CDK: export class EventbridgeStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); const targetCoreBus = new…
Yuriy Galanter
  • 38,833
  • 15
  • 69
  • 136
1
2
3
11 12