I using C# Identity for login/registering users. Everything works locally but when I publish live the register/login doesn't work. I believe it is due to the connection string because it is pointing to LocalDb. I've been trying to put it in my server database, but when I do, I get ApplicationUser not part of model. I'm only using the AspNetUser table for now. Any suggestions?
Default connection string
<add name="DefaultConnection"
connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20171104124939.mdf;Initial Catalog=aspnet-WebApplication1-20171104124939;Integrated Security=True"
providerName="System.Data.SqlClient"/>
Server connection string -- I'm using gearhost as my server provider.
<add name="connectionStringName"
connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=den1.mssql1.gear.host;initial catalog=databaseName;user id=userName;password=userPassword;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
This is the DefaultConnection
database context.. if I change this to my server connection string with copied identity tables, it gives me the "500, ApplicationUser not part of model"
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
Found exacly what I was looking for in this video..
https://www.youtube.com/watch?v=Y02ccL4-_K4
I basically needed to change the default connection string created by ASP.net to be pointed in my own database. Also, I needed to know how to create the identity tables in my database. The video shows me how to do these.