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
3
votes
2 answers

UserPrincipal extensions returns computers

I'm pretty new to active directory and I'm currently working on a library for a project to easily manage our active directory objects like users, resources, groups and so on. The library is in .NetStandard 2.0 and I use the Principal classes…
Papapinguy
  • 41
  • 5
3
votes
1 answer

Can I get the User Department from Active Directory using PrincipalContext()

I am trying to get the user's department from Active Directory. I have the following class: public class DomainContext { public string DisplayName { get; set; } public string Name { get; set; } public string SamAccountName {…
John John
  • 1
  • 72
  • 238
  • 501
3
votes
2 answers

UserPrincipal.FindByIdentity results in COM error 0x80005000

I've an MVC Intranet app that I've recently upgraded from .Net 4 to 4.6.1. This app queries user details from Active Directory to load details that aren't available in the Controller's User.Identity property and until lately has done so flawlessly.…
Pete
  • 1,807
  • 1
  • 16
  • 32
3
votes
1 answer

ASP.NET MVC 5: App Pool, Windows Authentication and Active Directory

Background: I have an MVC 5/C# app that interfaces an outside API. It uses the Active Directory users' Principal Context for authorization. The app checks if the UserPrincipal.Current has their Un/Pw combo stored in the Db to be used for any…
Beau D'Amore
  • 3,174
  • 5
  • 24
  • 56
3
votes
1 answer

Editing registry value for newly created user

I have a .NET application that creates a new local user like so: var principalContext = new PrincipalContext(ContextType.Machine); var userPrincipal = new UserPrincipal(principalContext); userPrincipal.Name =…
Bas
  • 1,946
  • 21
  • 38
3
votes
1 answer

How to Get Current User Principal

I want to use Windows Authentication and get User info such as Givenname, Surname, etc. I used UserPrincipal.Current in IIS and I got an exception, but IIS express looks fine.
Jaider
  • 14,268
  • 5
  • 75
  • 82
3
votes
1 answer

Setting DistinguishedName using UserPrincipal

When using DirectoryEntry, it is possible to set the CN of the new user account, but how to do it using UserPrincipal? The property is readonly. // From : http://msdn.microsoft.com/en-us/magazine/cc135979.aspx DirectoryEntry container = new…
Arnaud F.
  • 8,252
  • 11
  • 53
  • 102
2
votes
1 answer

Fetching list of locked AD users throws error. Am I using incorrect search terms?

first of all, I'm fairly new to programming in general. I'm working on a simple monitoring tool. I'm trying to get a list of all locked AD users. Thanks to stackoverflow I found someone who once had the same question, unfortunately his answer does…
2
votes
0 answers

Getting error while finding AD Groups of a user using PrincipalContext

I have a situation where I need to find AD groups of a user recursively. For Example : I have such group hierarchy - Group1 |_ Group2 |_ Group3 |_ UserA According to the hierarchy, Groups of UserA are…
raunakchoraria
  • 358
  • 2
  • 15
2
votes
1 answer

Could not create a service principal with the right permissions

I'm trying to run command: az acs create --orchestrator-type kubernetes --resource-group myResourceGroup --agent-count 1 --name myK8SCluster --generate-ssh-keys Which should generate principal and then kubernetes cluster. But there is error: Could…
Łukasz Baran
  • 1,229
  • 3
  • 24
  • 47
2
votes
1 answer

Is pageContext.request.userPrincipal stored in session? Can I get password too?

I'm learning Spring security and as I understand by using request.getUserPrincipal() we could access the name, we could get the name with pageContext.request.userPrincipal.name , This is my code (everything is working) : <%@taglib prefix="c"…
2
votes
0 answers

PrincipalContext and error Value was invalid

I have a WCF service with the code: var ctx = new PrincipalContext(IsLocalMachine(strDomain) ? ContextType.Machine : ContextType.Domain); Principal principal = Principal.FindByIdentity(ctx, name) I have 3 different test environments: 1: IIS 8.5 …
2
votes
1 answer

Log Out a User in MVC 5 Using a Custom ActionFilterAttribute

I have a custom ActionFilterAttribute that makes sure a value in the Session matches a value in the database. If the values don't match, it redirects the user to the Login action on the AccountController. public class CheckSessionAttribute :…
2
votes
1 answer

Where does user.identity.name (c#) get its value?

I'm pretty sure it does not get it from AD, although we are using AD internally. THe issue I am having is with an app that gets the current users name with user.identity.name, and tacks on the @mycompany.com then uses it to send emails from within…
BattlFrog
  • 3,370
  • 8
  • 56
  • 86
2
votes
1 answer

asp.net application userprincipal.findbyidentity works with browser on server, throws exception from my machine

I have an application that is running on an IIS 7 server, in this program I need to find all the groups that the current user is a member of. When I access the website using the browser on the server, it works perfectly, but when I try to access it…
1 2
3
11 12