The INSERT statement conflicted with the FOREIGN KEY constraint "FK_StudyClasses_AspNetUsers_AppUserId".

Asjad Butt 66 Reputation points
2022-11-12T07:22:19.05+00:00

Hi so im making lets say table 1 it will have a foregin key from table 2 now the table 2 is an asp.net identity user and has an id that is created by entity framework i want to use the asp net user id as a foriegn key but when i do and try to insert data through lets say swagger or postman i get the above error of insert statment conflicted ive been using this foreign key system through out my application but it is this asp net user table that gives an error

Asp Net user Table Ignore the public error
Table 1 or the table containing the asp net user as a foreign key
Maping profile
The dto
Controller Method

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,080 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,222 questions
{count} votes