So, I want potential clients to have to enter the least amount of info possible to get an account, to that end, I really don’t see the benefit of a username and email address, I’d rather just use the email address.

Pretty easy, edit the Register.cshtml to remove all traces of a ‘username’ field…

Edit the controller so that it now reads:

   model.UserName = model.Email;
   if (ModelState.IsValid) { /*...*/ }


F5 and … no

Hmmm, turns out the ModelState isn’t valid, and that’s down to the fact that I’ve left in the ‘Required’ bit on the UserName property in the AccountModels RegisterModel class.

    [Display(Name = "User name")]
    public string UserName { get; set; }


Conceivably, I don’t really need that property at all, and can probably just do away with it later, but for now it can remain… Bigger fish to fry and all that…


Print | posted @ Wednesday, October 26, 2011 8:50 AM

Comments on this entry:

No comments posted yet.

Post A Comment