Questions tagged [usermanager]

122 questions
2
votes
1 answer

ObjectDisposedException when creating user

I'm getting an error when I try to create a user. I got it at line 15 in the following code. 1 public async void AddOrganisationAdmin() 2 { 3 4 String OrganisationName = Request["OrganisationName"]; 5 …
Gert Kommer
  • 1,163
  • 2
  • 22
  • 49
2
votes
1 answer

UserManager.CreateIdentityAsync null reference

Im trying to modify the loginsystem that auto-creates when you create a new mvc project on visual studio 2013 sp 3. When i register my user i go to await SignInAsync(user, isPersisten:false); Which goes to: private async Task SignInAsync(User…
Daniel Gustafsson
  • 1,725
  • 7
  • 37
  • 78
1
vote
0 answers

Initializing UserManager in class library project

I have an ASP.NET Core 5.0 MVC application and a .NET 5.0 class library called Application.Data. Due to separation of concerns, I decided that the DbContext and migrations should be contained within the data library. The DDL migrations work…
1
vote
1 answer

How do I keep IdentityDbContext alive after a request so that a service can complete its task using UserManager?

From a Page I'm calling a service like so: _ = _importUserService.AddManyUserAsync(ValidatedUsers); I want the Page() to return and let the user/UI move on while the service adds many users utilizing UserManager in the background. The problem is…
1
vote
2 answers

How to create new UserManager object inside controller after DBContext changed

I want to have a refreshed UserManager object after my DbContext changed with new connectionString inside the Controller, I have injected the UserManager in the Controller but it's obvious that it will always have the last DbContext reference from…
Sabir Hossain
  • 1,183
  • 1
  • 25
  • 46
1
vote
1 answer

Add a JavaScript client to IdeniityServer4 & logging using username & password

My Problem statement is: The user will login to IdentityServer, invoke the web API with an access token issued by IdentityServer, and logout of IdentityServer. All of this will be driven from the JavaScript running in the browser. The closest link I…
1
vote
1 answer

How to test method in XUnit that needs UserManager, but uses in-memory database

I'm using ASP.NET Core 3.1 and XUnit for my unit tests. I built a database context factory class that instantiates an in-memory version of my database: public static class DbContextFactory { public static ApplicationDbContext CreateDbContext() …
MMilanov
  • 144
  • 1
  • 12
1
vote
1 answer

Using ExecuteInTransaction with UserManager

We are implementing EnableRetryOnFailure but as discussed on https://learn.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency, this does not work out of the box for user defined transactions. One of the recommendations from the above…
GGG
  • 201
  • 1
  • 10
1
vote
2 answers

ASP.NET Core Identity UserManager.IsInRole Call Works in 2.2 But Throws InvalidOperation in 3.0

I have 2 solutions that use ASP.NET Core Identity. One is v.2.2 the other is 3.0. They make calls to UserManager.IsInRole(user, role.Name). The code works in v.2.2 but throws an exception, "InvalidOperationException: There is already an open…
user3802434
  • 602
  • 1
  • 7
  • 14
1
vote
1 answer

Use UserManager GenerateUserTokenAsync to create custom tokens with extra data

I am using ASP.NET Core 2.2 and I need to generate custom tokens in my application. Asp.Net Core Identity UserManager can generate classic tokens like EmailVerification, ... But it has also a method to generate tokens with different purposes (MSFT…
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
1
vote
1 answer

Mediatr unable to resolve UserManager in ASP.Net Core

I am building ASP.Net Core App depending on this clean architecture example which is using MediatR to execute commands. And i want to use ASP.Net Core Identity in my app, so in my CreateUserCommandHandler i want to use UserManager to add new user,…
AlaaL
  • 333
  • 9
  • 28
1
vote
1 answer

Inject Custom UserManager To Controller Net Core 2.1

I'm having problems trying to inject my UserManager to my controller. This is my custom UserManager: public class ApplicationUserManager : UserManager { public ApplicationUserManager(IUserStore store,…
user1060082
  • 63
  • 2
  • 7
1
vote
1 answer

How to inject UserManager to another service in ASP.NET Core 2.0

I created a service that uses user manager identity public class UserManagerService : IUserManagerService { private readonly UserManager userManager; public UserManagerService(UserManager userManager) { …
1
vote
0 answers

UserManagerExtensions methods changing System.Security.Principal.WindowsIdentity

we are using Identity 2 with MVC 5 for our web project. Requirement is to be able configure impersonated user for web application in web.config like so
1
vote
2 answers

Login and Registration using in .NET Core Web API

I am implementing Authentication and Authorization Role base in Asp.Net Web API Core 1.1 . I am using JWT token for generating token and authenticating the request but i am stucking to match the username and password with the existing database…
1 2
3
8 9