asp.net mvc 4 - SimpleMembership - Add email to UserProfile - System.Data.SqlClient.SqlException: Invalid column name "Email" error -


i'm sure have followed steps, seem have missed something. using simplemembership in mvc4 app. add email userprofile table , in register , userprofile models, added register method, still getting error. here code:

models:

public class userprofile {     public int userid { get; set; }     public string username { get; set; }     public string email { get; set; } }  public class registermodel {     [display(name = "email address")]     [stringlength(20)]     // [required]     public string email { get; set; }      [display(name = "date of birth")]     //   [required]     public datetime dob { get; set; }      [required]     [system.web.mvc.remote("verifyuserexists", "account", errormessage="that username taken.")]     [display(name = "user name")]     public string username { get; set; }      [required]     [stringlength(100, errormessage = "the {0} must @ least {2} characters long.", minimumlength = 6)]     [datatype(datatype.password)]     [display(name = "password")]     public string password { get; set; }      [datatype(datatype.password)]     [display(name = "confirm password")]     [compare("password", errormessage = "the password , confirmation password not match.")]     public string confirmpassword { get; set; } } 

controller:

    public actionresult register(registermodel model)     {         if (modelstate.isvalid)         {             // attempt register user             try             {                 websecurity.createuserandaccount(model.username, model.password, new { email = model.email });                 websecurity.login(model.username, model.password);                  return redirecttoaction("index", "home");             }             catch (membershipcreateuserexception e)             {                 modelstate.addmodelerror("", errorcodetostring(e.statuscode));             }           } 

i not trying use email address login, want grab during registration step can send auto confirm email.

i have tried userprofile table included in ef model, , out, no difference. have confirmed table in db has email column.

if you're using default connection, open database clicking view -> server explorer expand defaultconnection. under tables see userprofile table. add columns table first , update database, add fields class.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -