如何解决请求网址未返回正确的链接地址
我使用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 举报,一经查实,本站将立刻删除。