Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC 4 RC - Aspnet_regsql.exe

I'm trying to enable login using the MVC 4 RC default template. I did it the same way as in MVC 3, Aspnet_regsql.exe -> SQL server. Then I made the connection string point to the SQL server.

When I try to register a new user I get this:

Server Error in '/' Application.

Invalid column name 'ApplicationId'.
Invalid column name 'UserName'.
Invalid column name 'ApplicationId'.
Invalid column name 'UserId'.
Invalid column name 'UserName'.
Invalid column name 'IsAnonymous'.
Invalid column name 'LastActivityDate'.

Error in AccountController:

              Line 85: // Attempt to register the user
              Line 86: MembershipCreateStatus createStatus;
Error here -> Line 87: Membership.CreateUser(model.UserName, model.Password, model.Email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus);
              Line 88:
              Line 89: if (createStatus == MembershipCreateStatus.Success)

I've been trying to google this error but no luck so far. Is there maybe some other way I should be doing this in MVC 4?

like image 942
judehall Avatar asked Jun 22 '12 20:06

judehall


1 Answers

I received the same error because I was using membership tables from aspnet_regsql.exe version 2.x. I ran the aspnet_regsql.exe executable in the version 2.x folder and uninstalled the tables. Then with the new universal providers you dont need to use the above executable anymore, the tables are created when you connect to the first time.

This article goes into more detail of the differences between the old aspnet_Memembership vs the Universal Providers.

Stronger Password Hasing Net

The key points from the article:

Firstly, there’s no more aspnet_regsql, you just make sure your connection string is set and the account has DBO rights (don’t worry, it doesn’t have to stay this way) then run the app up and attempt to perform any action which should cause the membership provider to hit the DB (i.e. log on – it doesn't matter that there isn't an account).

Thats it all there is to it.

like image 185
Jake1164 Avatar answered Oct 12 '22 00:10

Jake1164