首页  ·  知识 ·  
Label
      编辑:  图片来源:网络

using System.Collections.Specialized  

int loop1, loop2;
   NameValueCollection coll;
 
   // Load ServerVariable collection into NameValueCollection object.
   coll=Request.ServerVariables;
   // Get names of all keys into a string array.
   String[] arr1 = coll.AllKeys;
   for (loop1 = 0; loop1 < arr1.Length; loop1++)
   {
    Response.Write("Key: " + arr1[loop1] + "
");
    String[] arr2=coll.GetValues(arr1[loop1]);
    for (loop2 = 0; loop2 < arr2.Length; loop2++)
    {
     Response.Write("Value " + loop2 + ": " + arr2[loop2] + "
");
    }
   }


====以下是一个取得IP和操作系统以及浏览器的例子========

private string getIp()
{/*穿过代理服务器取远程用户真实IP地址:*/
if(Request.ServerVariables["HTTP_VIA"]!=null)
return Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
else
return Request.ServerVariables["REMOTE_ADDR"].ToString();
}
Label2.Text =getIp();
HttpBrowserCapabilities bc = new HttpBrowserCapabilities();
bc = Request.Browser;
string xitong ="你的操作系统为";
Label3.Text=xitong+bc.Platform + " 浏览器类型:" + bc.Type;

作者:  来源:CSDN
本文作者:佚名 来源:webjx.com
CIO之家 www.ciozj.com 微信公众号:imciow
   
免责声明:本站转载此文章旨在分享信息,不代表对其内容的完全认同。文章来源已尽可能注明,若涉及版权问题,请及时与我们联系,我们将积极配合处理。同时,我们无法对文章内容的真实性、准确性及完整性进行完全保证,对于因文章内容而产生的任何后果,本账号不承担法律责任。转载仅出于传播目的,读者应自行对内容进行核实与判断。请谨慎参考文章信息,一切责任由读者自行承担。
延伸阅读
也许感兴趣的
我们推荐的
主题最新
看看其它的
收藏至微信