すぐに使用できるメンバーシップをMVC4に追加しようとしています。
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));
}
}
}
モデルを変更しました
public class RegisterModel
{
// Username and password methods
public string Mobile { get; set; }
}
UserProfile
モデルにも追加しました。SqlExceptionが発生しましたが、接続が表示されません。とても単純なエラーのようですが。Nvarchar(MAX)
このエラーを回避しようとするDBが設定されます。
Invalid column name 'Length'