Hey everyone,
Just another small issue I ran into while attempting to retrieve a user’s ID:
You must call the “WebSecurity.InitializeDatabaseConnection” method before you call any other method of the “WebSecurity” class. This call should be placed in an _AppStart.cshtml file in the root of your site.
Thankfully the first Google result was pretty helpful: http://stackoverflow.com/a/15864133/522859
All you need to do is remove [InitializeSimpleMembership] from the top of the AccountController and then add the following line to App_Start/AuthConfig.cs
WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
Leave a Reply