im calling createuserandaccount method giving string in username , password. exception saying hardcoded string null. how can being possible!?! i-m missing here?
code: websecurity.createuserandaccount("admin", "admin", null, false);
sqlexception: cannot insert value null column 'userpwd', table 'servidb.dbo.user'; column not allow nulls. insert fails.
i changed table's name userprofile user , password column too. here mistake??
regards.
ps: dont know else of code show. if need more info, please ask.
edit: did :
websecurity.initializedatabaseconnection("connectionstring", "user", "userid", "username", autocreatetables: true);
and checked db , table user created column. entity code one
[table("user")] public class user { [key] [databasegenerated(databasegeneratedoption.identity)] public int userid { get; set; } [required] public string username { get; set; } [required] public string userpwd { get; set; } }
it's because changed column names, websecurity knows columns use, uses own generated tables, except table usernames. it's in initializesimplemembership.cs if workin on internet template.
websecurity.initializedatabaseconnection([here database username], [here database password], [here talbe name containing user name column], [here user name column] , autocreatetables: true);
so create 1 table username column , that's all, rest created websecurity in new tables.