Use Username instead of Email for identity in Asp.net mvc5 -


whenever create new application visual studio 2013 express web , using individual accounts authentication , hit register button notice implements 'email' instead of 'username' , same in loginviewmodel uses email sign in instead of username. how can change use username instead of default email without trouble? know how convert default 'guid' string type 'id' (integer type).

the linked question in accepted answer descibes how use email instead of username, op wanted username instead of email looking in identity 2.0 in mvc project.

in case else gets here google search easy this. if @ register post action setting username email address. so.........

add username registerviewmodel , add register view.

<div class="form-group">         @html.labelfor(m => m.username, new { @class = "col-md-2 control-label" })         <div class="col-md-10">             @html.textboxfor(m => m.username, new { @class = "form-control", @placeholder = "username or email" })         </div> </div> 

in register post action on accountcontroller set username viewmodel's username , email viewmodel's email.

var user = new applicationuser { username = model.username, email = model.email }; 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -