Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm using existing (generated) mechanism for login (i was created new web form - web application project).

I added tables for identity in my database and changed the conn string.

Functionality for registration works very fine, but when I log out, I can not log in again. I get the exception: System.Data.SqlClient.SqlException: Invalid column name 'User_Id'.

Nowhere in the code or database I dont have attribute or column with name "User_Id".

Line of error:
C#
authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);

Class of error: IdentityHelper

I did not change anything, except that I added this code
C#
public class ApplicationRole : IdentityRole
{
    public ApplicationRole() { }
}

public class ApplicationRoleManager : RoleManager<ApplicationRole>
{
    public ApplicationRoleManager()
        : base(new RoleStore<ApplicationRole>(new ApplicationDbContext()))
    {
    }
}

in IdentityModels.cs for managing user rules.

Does anyone have any idea for fix this problem? Thanks
Posted
Comments
Mostafa Asaduzzaman 11-Jun-15 21:09pm    
Are you using Entity Framework?
vezo11 12-Jun-15 4:53am    
No. I use only a conn string to the database. This is a problem because I do not migrate database. I use only Microsoft.AspNet.Identity.EntityFramework
[no name] 12-Jun-15 0:35am    
check ur table..
vezo11 12-Jun-15 5:01am    
My tables does not contain any column with the name "User_Id" - only with "UserId". If registration work fine (and records in the database), I do not know why login does not work. Maybe Identity use column name "UserId" to write in database, but to read Identity looking for a different name - "User_Id". But it does not make sense...

1 solution

The problem was in the database. The solution can be found here:
- entity framework 4.1 invalid column name[^]
- Invalid column name “User_Id”[^]

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900