请求网址未返回正确的链接地址

问题描述

我使用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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...