什么是Uri.Host和Uri.Authority之间的区别 [英] What's the difference between Uri.Host and Uri.Authority
问题描述
的System.Uri
的主机
,授权
,和 DnsSafeHost
。 MS提供了当主机
和 DnsSafeHost
不同的这里。
System.Uri
has Host
, Authority
, and DnsSafeHost
. MS provides a nice example of when Host
and DnsSafeHost
are different here.
我想类似的例如,/解释主机
和授权
。
I'd like a similar example/explanation for Host
and Authority
.
推荐答案
是布兰登是绝对正确的,在外行人而言
Yes Brandon is absolutely correct, in layman terms
管理局=主机名+端口号
Authority = Host Name + Port No
和如果URL协议是使用默认端口,比如说端口80用于HTTP URL,则只有在这种情况下,
管理局=主机名(端口号被假定为80),
And if URL protocol is using a default port, say port 80 for http URL, then only in that case Authority = Host Name (Port No is assumed to be 80),
而主机名或者是域名或IP地址
Whereas Host Name is either Domain Name or I.P Address
示例:
-
http://www.example.com/
结果
< BR>
管理局= 的 www.example.com结果
主机名= 的 www.example.com
http://www.example.com/
Authority = www.example.com
Host Name = www.example.com
http://255.255.255.255:8080/
结果
的 管理局= 的 255.255.255.255:8080结果
主机名称= 的 255.255.255.255结果
Authority = 255.255.255.255:8080
Host Name = 255.255.255.255
这篇关于什么是Uri.Host和Uri.Authority之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!