问题描述
我使用ASP.net MVC身份 我使用此代码来生成电子邮件确认
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Register(Registerviewmodel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser { UserName = model.Email,Email = model.Email };
var result = await UserManager.CreateAsync(user,model.Password);
if (result.Succeeded)
{
//await SignInManager.SignInAsync(user,isPersistent:false,rememberbrowser:false);
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
// Send an email with this link
string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
var callbackUrl = Url.Action("ConfirmEmail","Account",new { userId = user.Id,code = code },protocol: Request.Url.Scheme);
await UserManager.SendEmailAsync(user.Id,"Confirm your account","Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
ViewBag.link = callbackUrl;
return View("displayEmail");
//return RedirectToAction("Index","Home");
}
AddErrors(result);
}
// If we got this far,something Failed,redisplay form
return View(model);
}
链接看起来像这样(*表示IP地址)
请点击确认您的帐户
[href =“ HTTP:// 。 。 。 / Account / Confirm-email?userId = 7&code = HiacMLB88JLiXpLbJYzlafUGZ1Du3DCHef3x0lMwtQOw%2Bm0GjGeBRcnG4LIr96W%2FF3Qq4v3K%2B8jxmN2e77rUY9Vgan3WR11L6%2BYBVDZQQ3Ac
`
如何在IP地址后添加:8080端口 因为我用 HTTP:// 。 。 。 :8080 /
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)