现在的位置: 首页 > 综合 > 正文

HTTP头信息

2013年07月01日 ⁄ 综合 ⁄ 共 634字 ⁄ 字号 评论关闭
protected void Page_Load(object sender, EventArgs e)
{        
    System.Text.StringBuilder htmlStr 
= new System.Text.StringBuilder();
    
foreach (string key in Request.Headers.AllKeys) 
    {
        htmlStr.Append(key 
+ "" + Request.Headers[key] + "<br />");
    }
    Literal1.Text 
= htmlStr.ToString();
}

上面的代码输出如下内容:
Connection:Keep-Alive
Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:zh-cn
Host:localhost:8556
User-Agent:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; CIBA; .NET CLR 3.5.21022; InfoPath.2)
UA-CPU:x86
我自己解释不好,欢迎高手们讨论。

抱歉!评论已关闭.