Exception logging in with ASP.NET Identity RRS feed

  • Question

  • User983226961 posted

    A coworker and I are working on a Web Forms application that uses ASP.NET Identity. We have found that when one of us registers a user, the other person isn't then able to log in as that user. We also can't register new users. When we try to do one of these things, we get an SqlException that says "Cannot create file '...20160802115511.mdf' because it already exists. Change the file path or the file name and retry the operation." (The file name differs depending on the application and when it's created, of course.) The error is occurring on this statement in the LogIn method of the Login page:

    var result = signinManager.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, shouldLockout: false);

    Because the authentication database already exists, the application shouldn't be trying to create it. Any idea what could cause this problem? We are sharing applications over a server, if that makes any difference.

    Thursday, August 4, 2016 9:22 PM


  • User983226961 posted

    I just discovered the problem. I had deleted the authentication database because I wanted to enable automatic migration and use the Seed method to add users and roles, but I didn't delete the connection to the database. You can do that from the Server Explorer in Visual Studio. Then, you can delete the database from the Solution Explorer by using Show All Files so you can see the database in the App_Data folder. Here's where I found this information: http://stackoverflow.com/questions/20304058/how-to-re-create-database-for-entity-framework

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 4, 2016 10:22 PM