我终于开始工作了。当用户注册时,我有returnUrl,它包含重定向uri。现在我们假设应用程序在同一个域和端口上。所以我去掉了重定向uri。
var pat = "redirect_uri=([^&]+)";
var r = new Regex(pat, RegexOptions.IgnoreCase);
var m = r.Match(returnurl);
public static string EmailConfirmationLink(this IUrlHelper urlHelper, string userId, string code, string scheme, string returnUrl = "")
{
return urlHelper.Action(
action: nameof(AccountController.ConfirmEmail),
controller: "Account",
values: new { userId, code, returnUrl },
protocol: scheme);
}
当用户点击链接时,我会确认他们的电子邮件,并将其重新路由回我从重定向uri中提取的域
return Redirect(returnUrl);