I am using ARR on IIS 8.5 with a URL rewrite pointing to a server farm. The backend web sites run on the same machine, but on different ports, ie 8102
. Some of the backing web site nodes send emails for email confirmation and those mails contain an activation link that has a wrong port in it (host name is correct). The link has the same port which the web site instance has. But that is a problem since the link is then broken. In the code I am using to generate the link:
Url.Action("ConfirmMail", "Account",
new { userId = user.Id, code = UserManager.GeneratePasswordResetTokenAsync(user.Id)},
protocol: Request.Url.Scheme);
So the link the users get is https://correct_hostname:8102/Account/ConfirmMail?.....
The correct link should be https://correct_hostname/Account/ConfirmMail?.....
or https://correct_hostname:443/Account/ConfirmMail?.....
Any ideas how to make it work?
I think you can remove the port like this (non-tested code):
@Url.Action(
"ConfirmMail",
"Account",
new { userId = user.Id, code = UserManager.GeneratePasswordResetTokenAsync(user.Id)},
protocol: Request.Url.Scheme,
Request.Url.Host
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.