Questions tagged [usermanager]
122 questions
0
votes
1 answer
How to use ASP.NET Core Identity UserManager through static method to get Identity User data from DB
I have created an API (ASP.NET core 6) and I have also used Identity framework for user management.
Admin can make users active or inactive. so I want to check if the user is active or not
in each API call. So I have created an extension method and…

Pearl
- 43
- 8
0
votes
0 answers
change session length dynamically by role in asp.net core razor pages
I need to give different session length to users according to a certain role.
Since session length is configured in program.cs I tried to check the role in it.
The problem that in order to us IsInRole(...) function I need to know who is the current…

tzviya
- 537
- 1
- 4
- 14
0
votes
1 answer
Whats the difference between fetching values from ClaimsPrincipal vs UserManager and which is faster?
I have these extension methods below, 2 from ClaimsPrincipal and one from UserManager, all fetch email.
What is the difference and which one is faster? (i.e. doesn't require as much time to fetch from the database or doesn't fetch from the database…

chuckd
- 13,460
- 29
- 152
- 331
0
votes
0 answers
how to tell dotnet core version 7 UserManager to update it's security certificate to a new key
DotNet CORE V7 has a UserManager which is a part of the Microsoft Identity Framework.
When I attempt process an Http PUT request in my backend server, I am able to provide all the data that needs to be changed.
However, writing the updates back goes…

Chuck Duncan
- 1
- 1
0
votes
0 answers
`UserManager.AddClaimAsync` keeps throwing duplicate PK exception for new claims
The following code snippet:
Claim claim = claims.FirstOrDefault(c => c.Type == "roles");
if (claim != null)
await _userManager.RemoveClaimAsync(appUser, claim);
StringBuilder sb = new StringBuilder();
if (claim != null &&…

Kok How Teh
- 3,298
- 6
- 47
- 85
0
votes
0 answers
Install app restriction on some part of work profile
I want to use DISALLOW_INSTALL_APPS in UserManager on my work profile. But I want install and update applications that exits in my app store, but don't let to install other app stores out of my app. How should do it?
It means that I want to update…

nazanin
- 51
- 6
0
votes
0 answers
Is UserManager the best approach for CRUD operations with IdentityServer4 in ASP.NET Core 6 Web API?
I'm very new with those things, so I have some problems with understanding and figuring out which approach to use.
Currently, I am using ASP.NET Core 6 and IdentityServer4 in my project. I am configuring my authorization server and there I have some…

Long
- 1
0
votes
0 answers
Android: Difference between UserManager's isUserUnlocked and KeyguardManager's isKeyguardLocked
I am working with Android and I am unsure what exactly UserManager and KeyguardManager do / how they relate with each other.
From the Docs:
UserManager:
isUserUnlocked: On devices with direct boot, a user is unlocked only after they've entered their…

frid000
- 41
- 8
0
votes
1 answer
UserManager not updating User after changes to a property .net7
I'm getting an "ConcurrencyFailure" with "Optimistic concurrency failure, object has been modified." message after trying to save a new object to a list.
I tried the methods with the row version and [ConcurrencyCheck] in the property but still no…
0
votes
1 answer
Getting all users with roles in ASP.NET Core
I am configuring identity user, I have seeded users with roles
by many to many relationship as follows:
public class AppUser : IdentityUser
{
public string DisplayName { get; set;}
public ICollection UserRoles { get;…

King Genius
- 51
- 1
- 1
- 6
0
votes
1 answer
how can I access usermanager in ASP.NET Core MVC webbapplication
I try to access usermanager in order to find a user. But struggling to figure out how this should be done. Here is what I have so far:
ApplicationDbContext:
public class ApplicationDbContext : IdentityDbContext
{
…

MTplus
- 2,077
- 4
- 34
- 51
0
votes
1 answer
I am Testing User Manager Functionality in asp. Net core clean Architecture, but user Manager method addClaim not working
I am mocked the UserStore and userManager and getting User by userManager method FindByIdAsync Correctly but when I send That User and one claim to AddClaim Function Its Giving me null value.
Here Is my Unit Test Setup and test In Which I am setting…

IkramK
- 3
- 2
0
votes
0 answers
Identity ChangePasswordAsync returns DuplicateUserName
Thank you for taking the time and reading this.
I've searched everywhere but didn't find the answer to this problem :(
public async Task> ChangePassword(ChangePasswordCommand model, string userId)
{
…
0
votes
1 answer
Checking if the user has email confirmed from a partial razor view
I have a partial named _Username which displays the currently logged in users menu and allows the user to change settings etc...
I need to check whether the current user has a confirmed email address in the database from this partial but for some…

alex cardoso
- 13
- 3
0
votes
0 answers
Problem while getting the currentUser in HttpGet in Aspnetcore
I am making an Aspnetcore project for a client but facing a problem while getting the user/visitor registered and getting the current logged in visitor.
I have made the modal - Visitor.cs below:
using System.ComponentModel.DataAnnotations;
using…

Himanshu Sharma
- 315
- 2
- 9