Asp.net identity encrypt password -


i using asp.net identity , need encrypt password compare passwordhash exist in database.

this code :

 var passhash = new passwordhasher().hashpassword("123456");  using (efdbcontext _db = new efdbcontext())  {     var users = _db.users.where(u => u.passwordhash == passhash);  } 

i getting empty result, in database exist user has password "123456"

password hashes compared using method verifyhashedpassword passwordhasher class why code not working, check link:

https://msdn.microsoft.com/en-us/library/microsoft.aspnet.identity.passwordhasher.verifyhashedpassword(v=vs.108).aspx#m:microsoft.aspnet.identity.passwordhasher.verifyhashedpassword(system.string,system.string)

if have retrieve users using password, think can't using ef (it can't translate verifyhashedpassword method sql query), have retrieve users , compare password each one.

if want retrieve single user search email , compare password using verifyhashedpassword.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -