Questions tagged [asp.net-identity]
The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems.
8,922
questions
0
votes
1
answer
49
views
ASP.NET Core Identity Role: Access error even though the role is defined
In my project, the user area is kept on the root side and admin is in areas.
The login page, layouts and views of both areas are different from each other. How will I do the role setting in these two ...
1
vote
1
answer
60
views
ASP.Net Core Identity disable/remove Register and Manage
I created an ASP.Net Core project using Identity and Entity framework core. I only added Login and Logout but for some reason the Account/Register and Account/Manage views and controllers work even ...
0
votes
1
answer
59
views
Account Login giving HTTP ERROR 400: This page isn’t working in ASP.NET Core MVC
The account login used to work fine, but now it gives error :
This page isn’t working
If the problem continues, contact the site owner.
HTTP ERROR 400
The browser url is https://localhost:7185/...
0
votes
0
answers
20
views
IdentityServer with inheritance design. Update-database error
I am using IdentityServer in dotnet. I have a base type EntityUser that inherits the IdentityUser<int> class. The entityuser is a base class for multiple user types.
After creating a migration ...
-1
votes
0
answers
65
views
Using "Identity " in LoginController
I specified the login page for the entire project. : "Login/Index"
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<Context>();
services....
0
votes
1
answer
82
views
INSERT statement conflicted with the FOREIGN KEY constraint Id of AspNetUsers(IdentityUser) in ASP.NET Core MVC
I created A registration panel for Doctor, patient and Admin, when I'm trying to register or insert a data its gives error like this,
SqlException: The INSERT statement conflicted with the FOREIGN ...
0
votes
0
answers
38
views
Authentication with Identity, OpenID & JWT
Yeah, I know I'm asking for a lot. So basically what I want is this:
I want to use the built-in (local) authentication routines using Microsoft Identity. I also want to authenticate against an OpenID-...
0
votes
0
answers
33
views
What is wrong with my one-to-one EF Core relationship setup?
I am attempting to convert an Optimizely CMS ASP.NET application from .NET 4.x to .NET 7.
I have two related EF Core entities:
public class ScholarshipApplication
{
public virtual AppUser User { ...
0
votes
0
answers
19
views
AspNetCoreIdentity with MySql: Object must be the same type as the enum. MySql.EntityFrameworkCore.Metadata.MySQLValueGenerationStrategy
I am trying to build AspNetCoreIdentity with MySql database.
I added all the necessary configuration and reached to the point where the project has successfully generated the AspNetCore tables ...
0
votes
0
answers
34
views
why asp.net identity is deisgned to run authorization when users not even being authenticated in the first place?
below is the code
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IAuthorizationHandler, CustomRequirementHandler>(); //...
0
votes
1
answer
60
views
asp.net Identity: CreateAsync cannot access a disposed object
I am trying to create a user from a blazer component.
here is my injection:
@inject UserManager<CustomUser> usrm
And the implementation:
async Task<bool> CreateLoginUser()
{
...
0
votes
2
answers
77
views
ASP.NET Core cookie time expiration validation
I set cookie expiration time to 120 seconds, but after this time passed, I'm still authorized in system. Does ASP.NET Core authentication middleware actually validate if a cookie is expired?
So this ...
1
vote
1
answer
56
views
Can I set an IssuerSigningKey with Identity API Endpoints in a .NET 8 Web API using AddBearerToken?
I've developed a web API using the new Identity API endpoints feature.
In my Next.js frontend, I've implemented protected pages, accessible only to authenticated users. To enable user access to these ...
0
votes
1
answer
119
views
Customizing Identity in ASP.NET Core 8
I am trying to add some additional fields to my identity user.
I found that this is fairly straightforward by creating a new class inheriting from IdentityUser and passing the inherited class to the ...
1
vote
1
answer
69
views
Adding Users To Roles in .Net 8 Blazor
I trying to seed my database with a default admin user and 3 roles. I am doing this in the Program.cs file. The code is as follows:
using (var scope = app.Services.CreateScope())
{
var ...
0
votes
1
answer
59
views
My ModelState.IsValid return false on .Net7
I am trying register a new user basically. But ModelState.IsValid return false. I can't solve this problem. I am using Identity in this project.
Here is my UserRegisterController:
using Microsoft....
0
votes
1
answer
31
views
Proper way to use strongly-typed Ids with IdentityUser in ASP.NET?
I'm following clean architecture and Domain Driven Design in my project. I'm using strongly typed Id for my User entity. User entity is extended from ASP.NET IdentityUser class. But my issue is when I ...
0
votes
0
answers
328
views
In Blazor .Net 8 how to use Cookie Authentication in HttpClient for the Server part of Interactive Auto component calling a WebApi on the same project
I created a .Net 8 Blazor project with
Individual Identity
Interactive Auto
Per component interactivity.
I added Nuget Package to .Client project
Microsoft.Extensions.Http
Added to both .Server and ...
0
votes
0
answers
9
views
How does MS Identity SecurityStampValidator work with EF Core? dotnet 7 web app
In dotnet 7 web app: for SecurityStampValidator:
What are the consequences of shortening the validation interval from 30 mins to 1 min?
My concerns in doing this are: how often is the database hit? Is ...
0
votes
1
answer
25
views
There is no implicit reference conversion from 'EntityLayer.Concrete.AppUser' to 'Microsoft.AspNetCore.Identity.IdentityUser'
Where am I making a mistake? Can you help me ?
Thanks
0
votes
0
answers
14
views
AddIdentityCore and IDataProtectorProvider in .NET Identity
When using .NET Identity, while registering services, if I call AddDefaultTokenProviders method after using AddIdentityCore it throws this error:
System.AggregateException: Some services are not able ...
0
votes
1
answer
63
views
C# & ASP.NET Core : foreign key violation for custom IdentityUser
I want to use an extended IdentityUser class with additional attributes:
namespace SpaceShip.Model;
using Microsoft.AspNetCore.Identity;
public class UserEntity : IdentityUser
{
// Additional ...
0
votes
0
answers
13
views
MongoDB identity in ASP.NET throws "Value cannot be null. Arg_ParamName_Name" when UserManager tries to acccess db
Last week my code was working. Then yesterday a started getting "Value cannot be null. Arg_ParamName_Name" whenever I tried to access the Users collection in my MongoDB database
Im using ...
0
votes
0
answers
80
views
Authentication in .NET 8 web app allowing 1) Entity Framework / Identity as well as 2) SSO using Microsoft Entra/AAD, and Google - can't do both 1 & 2
I have a .NET 8 Web Application that I want to allow authentication using Entity Framework / Identity, as well as SSO using Microsoft Entra / Azure Active Directory (AAD), and Google.
I can get all ...
0
votes
1
answer
37
views
How do I refresh custom claims on a .net Cookie Identity on an interval? (IE: every half hour)
I inherited a ASP.Net site using Microsoft Identity for authentication and authorization. We use SQL for the identity database.
I am not understanding something with the site's claims logic. We are ...
0
votes
1
answer
20
views
ASP.Net 6 No service for type 'Microsoft.AspNetCore.Identity.UserManager
I've been trying to set up roles and users in startup.cs. I now have the roles working but users just won't work producing "No service for type 'Microsoft.AspNetCore.Identity.UserManager'". ...
0
votes
1
answer
32
views
Calling Identity Register.cshtml from controller
I have installed Asp.net core Identity and have used it in a previous applications without any real issues. Login and Register have always used a link from a web page - e.g.:
\<a href="/...
0
votes
1
answer
74
views
Extend Scaffolded DbContext to use IdentityDbContext
I'm using .NET8 RC2 Version along with EF Core and I scaffolded an Existing Database using dotnet ef dbcontext scaffold command.
This command generated Entities and a AutoGeneratedDbContext
I know I ...
1
vote
1
answer
60
views
Do I need cookies
My situation:
I'm using Duende identity server for authentication in browser extensions and mobile apps using grant type "authorization_code". For authentication, my clients are redirected ...
0
votes
1
answer
40
views
ASP.NET Core Identity: How to Use EF Core Transactions?
I use EF Core in my project, and I want to achieve atomicity when using built-in Identity methods (such as CreateAsync or AddClaimsAsync). Here is my use case:
#region CREATE USER & SET ROLE
var ...
1
vote
1
answer
63
views
Facing multiple errors on identity implementation
I am trying to implement the identity in my web application. I added the custom user which inherits from the IdentityUser base class. For the roles, I use the base IdentityRole class. I also have ...
1
vote
0
answers
75
views
Unable to find type or namespace signinmanager tuser
I am having issues with making a get request inside my GetAll method in the controller.
[HttpGet("GetAll")]
public async Task<IActionResult> GetAllTasks()
{
...
0
votes
1
answer
63
views
I can't create a user through Identity in ASP.NET Core
I'm working on a project which is a Rest API. It's done following Clean Architecture. The API is secured by JWT so once you have the token you can modify the models and entities in database. I used ...
0
votes
0
answers
34
views
ASP.NET Identity Cookie not being set on localhost with different ports
I have two applications (.NET 7 with Angular), both on localhost but different ports
App 1: This is a shared web API and it acts as a single sign on point for my other application.
App 2: This is the ...
0
votes
2
answers
116
views
Handling unauthenticated or unauthorized API requests in ASP.NET Identity
I'm currently working on an ASP.NET project where I'm using ASP.NET Identity to manage user accounts. There is also an API included in my web application. My current problem is that when a client ...
0
votes
1
answer
29
views
GraphServiceClient throw an exception when AzureAD is not the default authentication scheme
In my ASP.NET Core application I've multiple authentication scheme.
GraphServiceClient throw IDW10503: Cannot determine the cloud Instance. The provided authentication scheme was '' exception if ...
0
votes
0
answers
21
views
Is it possible to combine IdentityDbContext with my app's DbContext?
I have a distinct database using the Identity Library IdentityDbContext class to define the database.
And I have my own MyAppDbContext for all the data in my application.
I do want the Identity ...
0
votes
1
answer
30
views
Is IdentityUser.PhoneNumber ignored in the Identity library?
The ASP.NET Identity library appears to have dropped all use of IdentityUser.PhoneNumber. Is it still used somewhere? Or does it remain solely so it doesn't break any existing apps that use the ...
0
votes
0
answers
28
views
ASP.NET Identity UserManager: how to query on "Users" property?
I have written this UserManager and created a new method called CountofPhoneNumberAsync for it:
public class MyUserManager : UserManager<User, int>
{
public MyUserManager(IUserStore<User, ...
0
votes
1
answer
48
views
RequireConfirmedAccount false and email confirmation
I am using ASP.NET Core Identity with RequireConfirmedAccount = false. The true option is too inconvenient for users because they cannot see the email confirmation page to resend the email token in ...
0
votes
2
answers
30
views
iMapster's issues with identity in .NET
I want to map a DTO with the identity model (entity).
But I get the following error
InvalidOperationException: The instance of entity type 'IdentityUser' cannot be tracked because another instance ...
0
votes
1
answer
73
views
ASP.NET Core and Microsoft Graph
I've an ASP.NET Core web application.
Users can login with username and password or with Azure AD.
In a page with many info I want to show an info from Graph (e.g. Unread emails counter) only for ...
0
votes
1
answer
96
views
ASP.NET Core multi-authentication
I have an ASP.NET Core web application for a Content Management System.
Therefore, the pages are dynamic and consist of dynamic areas. Each area has a class that manages its content.
Now, I need to ...
0
votes
1
answer
61
views
ASP.NET identity core vs. self hosted authentication vs. third party authentication provider
I'm building an ASP.NET API with Flutter frontend.
I want to authenticate a user, authorize and store user information like date of birth.
As far as I've learned there are 3 options:
Use ASP.NET core ...
1
vote
0
answers
65
views
ASP.NET Identity Add / Import External User Automatically
I have an app that uses Microsoft ASP.NET Core Identity. A user that wishes to use Azure AD as an external login provider must first login with their (Core Identity) User Id and password, and link ...
0
votes
0
answers
28
views
Asp.Net chunking cookie issue
I am using ASP.NET Identity. The login app is .NET6, the apps themselves are .NET 4.8 I followed this article to set this up and it works fine... just about https://github.com/dotnet/AspNetCore.Docs/...
0
votes
0
answers
86
views
Cookie based authentication in .NET 6 Core API using Identity
I have created a new .NET Core API project in .NET 6 and implemented Cookie authentication using Identity.
I have created the method below to create cookie
`public async Task ...
0
votes
1
answer
53
views
ASP.NET Core Open Identity Connect client. How to store given_name in claims?
I have an ASP.NET Core application which uses OpenIdConnect authentication using the following configuration:
builder.Services.AddAuthentication()
.AddOpenIdConnect(
"oidc",
...
0
votes
0
answers
30
views
Why am I getting Invalid Token from AspNet.Identity
Startup.cs :
...
services.AddIdentityCore<CustomerEntity>()
.AddEntityFrameworkStores<ClientContext>()
.AddDefaultTokenProviders()
.AddSignInManager<SignInManager<...
0
votes
1
answer
50
views
when i create mvc controller with views,using entityframework i cant route to it
My control is built well, but I can't get to that path and I get this error:
An unhandled exception occurred while processing the request.
InvalidOperationException: Unable to resolve service for ...