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] + "<br> ");
String [] arr2 = Coll. getvalues (arr1 [loop1]);
For (loop2 = 0; loop2 <arr2.length; loop2 ++)
{
Response. Write ("value" + loop2 + ":" + arr2 [loop2] + "<br> ");
}
}
==== The following is an example of obtaining IP addresses, operating systems, and browsers ========
Private string getip ()
{/* Obtain the real IP address of the remote user through the proxy server :*/
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 = "your operating system is ";
Label3.text = Xitong + bc. Platform + "browser type:" + bc. type;