IIS URL在生成的电子邮件链接中重写错误的端口

时间:2023-01-09 03:30:11

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, i.e. 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:

我在IIS 8.5上使用ARR,并指向服务器场的URL重写。后端网站在同一台机器上运行,但在不同的端口上运行,即8102.一些支持网站节点发送电子邮件以确认电子邮件,这些邮件包含一个错误端口的激活链接(主机名正确) 。该链接具有与网站实例相同的端口。但这是一个问题,因为链接会被破坏。在我用来生成链接的代码中:

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?.....

所以用户获得的链接是https:// correct_hostname:8102 / Account / ConfirmMail?.....正确的链接应该是https:// correct_hostname / Account / ConfirmMail?.....或https:// correct_hostname :443 /帐号/ ConfirmMail .....

Any ideas how to make it work?

任何想法如何使其工作?

1 个解决方案

#1


0  

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
)

More information here

更多信息在这里

#1


0  

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
)

More information here

更多信息在这里