1
我有以下功能,在过期的链接中重新生成确认电子邮件(以完成注册)。根据他的用户ID获取用户的电子邮件地址.net身份
[AllowAnonymous]
[HttpGet]
[Route("ResendConfirmationEmail")]
public async Task<IHttpActionResult> ResendConfirmationEmail(string userId = "")
{
if (string.IsNullOrWhiteSpace(userId))
{
ModelState.AddModelError("", "User Id is required");
return BadRequest(ModelState);
}
if (userId.GetHashCode() != null)
{
var code = await UserManager.GenerateEmailConfirmationTokenAsync(userId);
var callbackUrl = new Uri(Url.Link("ConfirmEmailRoute", new { userId, code = code }));
string subject = "Please confirm your account";
string body = "Please confirm your account by clicking this : <a href=\"" + callbackUrl + "\">link</a>";
SendEmail(?????, callbackUrl, subject, body);
}
return Ok();
}
我怎样才能从webUsers
表中的用户的电子邮件基于他userid
?
'UserManager'有一个叫做'FindByIdAsync' – tmg