c# - The authentication provider returned an error. Please verify your entry and try again -
edit: turns out due characters in languages , characters such i/u etc.
[httppost] /*[authorize(roles = "admin")]*/ public actionresult register(registermodel model) { if (modelstate.isvalid) { var users = _userdb.userprofiles.where(x => x.username == model.username); if (users.any()) { modelstate.addmodelerror("error", "username exists."); return view(model); } try { if (model.isadmin == false) { websecurity.createuserandaccount(model.username, model.password, propertyvalues: new { cellphone = model.cellphone, email = model.email, socialno = model.socialno, department_id = model.departmentid }); } else { websecurity.createuserandaccount(model.username, model.password, propertyvalues: new { cellphone = model.cellphone, email = model.email, socialno = model.socialno , department_id = 9999 }); roles.addusertorole(model.username, "admin"); } return redirecttoaction("departments", "index"); } catch (membershipcreateuserexception e) { modelstate.addmodelerror("", errorcodetostring(e.statuscode)); } } // if got far, failed, redisplay form return view(model); }
i getting error , not helpful. want register user.
why getting error? idea?
note that, userprofile
getting data not membership table.
Comments
Post a Comment