如何在 frm (winForms) 中创建 PasswordHash asp 身份 o 生成 PasswordHash
how create PasswordHash asp identity in frm (winForms) o generate PasswordHash
美好的一天,你可以帮我指出如何生成自动身份模板的 PasswordHash 类型,如果字段和 BD 等于发送的参数(通过),我需要制作一个响应 tru 的 Web 服务
我称创建 asp.net 的模板为:
Protected Sub LogIn(sender As Object, e As EventArgs)
If IsValid Then
' Validate the user password
Dim manager = Context.GetOwinContext().GetUserManager(Of ApplicationUserManager)()
Dim signinManager = Context.GetOwinContext().GetUserManager(Of ApplicationSignInManager)()
' This doen't count login failures towards account lockout
' To enable password failures to trigger lockout, change to shouldLockout := True
Dim result = signinManager.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, shouldLockout:=True)
Select Case result
Case SignInStatus.Success
IdentityHelper.RedirectToReturnUrl(Request.QueryString("ReturnUrl"), Response)
Exit Select
Case SignInStatus.LockedOut
Response.Redirect("/Account/Lockout")
Exit Select
Case SignInStatus.RequiresVerification
Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}&RememberMe={1}",
Request.QueryString("ReturnUrl"),
RememberMe.Checked),
True)
Exit Select
Case Else
FailureText.Text = "Intento inválido de inicio de sesión"
ErrorMessage.Visible = True
Exit Select
End Select
End If
End Sub
我需要创建加密密码来和BD比较
此 class 正在身份框架中进行密码哈希处理。
使用用户管理器的 PasswordHasher
属性 生成哈希密码并将其与存储的数据进行比较:
var userManager=HttpContext.GetOwinContext().GetUserManager<ApplicationUSerManager>();
string hashedPassword=userManager.PasswordHasher.HashPassword("myPass");
美好的一天,你可以帮我指出如何生成自动身份模板的 PasswordHash 类型,如果字段和 BD 等于发送的参数(通过),我需要制作一个响应 tru 的 Web 服务
我称创建 asp.net 的模板为:
Protected Sub LogIn(sender As Object, e As EventArgs) If IsValid Then ' Validate the user password Dim manager = Context.GetOwinContext().GetUserManager(Of ApplicationUserManager)() Dim signinManager = Context.GetOwinContext().GetUserManager(Of ApplicationSignInManager)() ' This doen't count login failures towards account lockout ' To enable password failures to trigger lockout, change to shouldLockout := True Dim result = signinManager.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, shouldLockout:=True) Select Case result Case SignInStatus.Success IdentityHelper.RedirectToReturnUrl(Request.QueryString("ReturnUrl"), Response) Exit Select Case SignInStatus.LockedOut Response.Redirect("/Account/Lockout") Exit Select Case SignInStatus.RequiresVerification Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}&RememberMe={1}", Request.QueryString("ReturnUrl"), RememberMe.Checked), True) Exit Select Case Else FailureText.Text = "Intento inválido de inicio de sesión" ErrorMessage.Visible = True Exit Select End Select End If End Sub
我需要创建加密密码来和BD比较
此 class 正在身份框架中进行密码哈希处理。
使用用户管理器的 PasswordHasher
属性 生成哈希密码并将其与存储的数据进行比较:
var userManager=HttpContext.GetOwinContext().GetUserManager<ApplicationUSerManager>();
string hashedPassword=userManager.PasswordHasher.HashPassword("myPass");