I am trying to add to the MVC 4 out of the box membership.
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Attempt to register the user
try
{
WebSecurity.CreateUserAndAccount(model.UserName, model.Password, model.Mobile);
//I added model.Mobile
WebSecurity.Login(model.UserName, model.Password);
return RedirectToAction("Index", "Home");
}
catch (MembershipCreateUserException e)
{
ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
}
}
}
I changed the model
public class RegisterModel
{
// Username and password methods
public string Mobile { get; set; }
}
I also added it to the UserProfile
Model. I am getting a SqlException and i just don't see the connection. It seems like such a simple error but. The DB is set to Nvarchar(MAX)
which is to try to avoid this error.
Invalid column name 'Length'