Asp.net mvc 4 如何在ebSecurity.GeneratePasswordResetToken中绕过用户名验证

Asp.net mvc 4 如何在ebSecurity.GeneratePasswordResetToken中绕过用户名验证,asp.net-mvc-4,Asp.net Mvc 4,我正在尝试在MVC应用程序中实现WebSecurity.GeneratePasswordResetToken 以下是我的方法的一部分,它应该发送一个链接来重置用户密码链接: [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public ActionResult SendPasswordLink(ForgotPassword email) { var emailHelp = new Helper(); if (Mod

我正在尝试在MVC应用程序中实现WebSecurity.GeneratePasswordResetToken

以下是我的方法的一部分,它应该发送一个链接来重置用户密码链接:

 [HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult SendPasswordLink(ForgotPassword email)
{
    var emailHelp = new Helper();

    if (ModelState.IsValid)
    {
        var token =
        WebSecurity.GeneratePasswordResetToken(email.EmailAddress, 60);
在上面代码中我尝试分配令牌的那一行,我一直收到以下错误:

No user found that has the name test@site.com
在尝试调用SendPasswordLink方法之前,我已经实现了自己的验证,以验证用户是否有效

如何绕过Web安全用户名验证:


我只需要生成一个令牌以附加到我的密码重置链接

如果生成的令牌未绑定到用户,您希望如何工作?这听起来不像是代码问题,但更可能是设计问题。有没有其他方法可以使用过期的websecurity添加令牌?没有。听起来您需要编写自己的提供者。