一,获得网页来访者IP地址的代码是:
您的IP是: <% =Request.ServerVariables("REMOTE_ADDR") %>
二,获得操作系统版本的代码是:
<% response.Write operationsystem & "<br>" & browser
function operationsystem() '操作系统版本 agent = Request.ServerVariables("HTTP_USER_AGENT") if Instr(agent,"NT 5.2")>0 then SystemVer="Windows Server 2003" elseif Instr(agent,"NT 5.1")>0 then SystemVer="Windows XP" elseif Instr(agent,"NT 5")>0 then
SystemVer="Windows 2000" elseif Instr(agent,"NT 4")>0 then
SystemVer="Windows NT4" elseif Instr(agent,"4.9")>0 then
SystemVer="Windows ME" elseif Instr(agent,"98")>0 then
SystemVer="Windows 98" elseif Instr(agent,"95")>0 then
SystemVer="Windows 95"
else SystemVer="未知" end if
operationsystem="您的操作系统是: " & SystemVer end function %>
三,获得浏览器版本的代码是:
<% function browser() '浏览器版本 agent = Request.ServerVariables("HTTP_USER_AGENT") if Instr(agent,"MSIE 6.0")>0 then browserVer="Internet Explorer 6.0" elseif Instr(agent,"MSIE 5.5")>0 then browserVer="Internet Explorer 5.5" elseif Instr(agent,"MSIE 5.01")>0 then browserVer="Internet Explorer 5.01"
elseif Instr(agent,"MSIE 5.0")>0 then browserVer="Internet Explorer 5.00" elseif Instr(agent,"MSIE 4.0")>0 then browserVer="Internet Explorer 4.0" else browserVer="未知" end if browser="您的浏览器版本: " & browserVer if Instr(agent,"TencentTraveler")>0 then '检查是否正在使用腾讯TT
browser=browser&" |目前正使用TencentTraveler" end if end function %>
Deom:
protected void Page_Load(object sender, EventArgs e) { //string info = "客户端IP:" + Page.Request.UserHostAddress; //info += "<br/>用户信息:" + Page.User; //info += "<br/>服务器电脑名称:" + Page.Server.MachineName; //info += "<br/>当前用户电脑名称:" + System.Net.Dns.GetHostName(); //info += "<br/>当前电脑名:" + System.Environment.MachineName; //info += "<br/>当前电脑所属网域:" + System.Environment.UserDomainName; //info += "<br/>当前电脑用户:" + System.Environment.UserName; //info += "<hr/>"; //info += "<br/>浏览器类型:" + Request.Browser.Browser; //info += "<br/>浏览器标识:" + Request.Browser.Id; //info += "<br/>浏览器版本号:" + Request.Browser.Version; //info += "<br/>浏览器是不是测试版本:" + Request.Browser.Beta; //info += "<br/>浏览器的分辨率(像素):" + Request["width"].ToString() + "*" + Request["height"].ToString();//1280/1024 //info += "<hr/>"; //info += "<br/>客户端的操作系统:" + Request.Browser.Platform; //info += "<br/>是不是win16系统:" + Request.Browser.Win16; //info += "<br/>是不是win32系统:" + Request.Browser.Win32; //Response.Write(info); //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 + ": " + Server.HtmlEncode(arr2[loop2]) + "<br>"); // } //} //Response.End(); if (Request.ServerVariables["HTTP_USER_AGENT"].ToString().Contains("WOW64")) { Response.Redirect("/Silverlight/Silverlight_x64.exe"); } else { Response.Redirect("/Silverlight/Silverlight.exe"); } }