加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – ServerVariables [“HTTP_HOST”]和ServerVariables

发布时间:2020-12-15 23:32:27 所属栏目:asp.Net 来源:网络整理
导读:我对这两个服务器变量的区别感到困惑.检查IIS文档,它说: HTTP_HOST Returns the name of the Web server. This may or may not be the same as SERVER_NAME depending on type of name resolution you are using on your Web server (IP address,host heade
我对这两个服务器变量的区别感到困惑.检查IIS文档,它说:

HTTP_HOST

Returns the name of the Web server.
This may or may not be the same as
SERVER_NAME depending on type of name
resolution you are using on your Web
server (IP address,host header).

服务器名称

The server’s host name,DNS alias,or
IP address as it would appear in
self-referencing URLs.

有人可以提供一些例子,如何可以不同?

我们在我们的网络农场中有2个IIS Web服务器,每个都有2个网站(当然,每个服务器相同).

对于每个网站都有约5个左右的绑定.

那么价值观是什么?有什么不同?

解决方法

刚刚发现,在IIS托管的aspx页面之一中启用跟踪,SERVER_NAME只返回服务器名称,而HTTP_HOST返回站点运行的servername:port.启用跟踪集

<%@ Page Language =“C#”AutoEventWireup =“true”CodeBehind =“WebForm1.aspx.cs”Inherits =“WebApplication3.WebForm1”Trace =“true”%>

注意跟踪值

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读