HttpContext.Current.Request.Url.Authority给出了错误的授权机构名称
本文关键字:错误 授权 机构 Request Current Url Authority HttpContext | 更新日期: 2023-09-27 17:58:35
我有两个负载平衡的生产web服务器,它们位于DMZ中。我有一个表单,需要根据某些条件打开另一个表单。其中一个服务器运行良好,并提供了完整的权限名称,即"host.nn.com"。另一个产品服务器只返回"host",因此找不到页面。这是我正在使用的代码:
urlString.Append(url.Scheme);
urlString.Append("://");
urlString.Append(url.Authority);
urlString.Append("/somedir/anotherdir/");
urlString.Append(formName + ".aspx");
服务器1(正在工作)返回http://host.n.n.com/somedir/anotherdir/formName.aspx服务器2(坏了)返回http://host/somedir/anotherdir/formName.aspx
IIS在两台服务器上的配置似乎相同。
提前感谢的任何帮助
如果用户的请求是从"host.nn.com"或"host"发出的,则该属性将反映这一点。您可以使用在本地进行测试http://localhost/yoursite/page.aspxvshttp://yourcomputername/yoursite/page.aspx.同一页面将分别返回"localhost"answers"yourcomputername"。
为什么不将URL设置为配置设置?