服务器变量的一点总结
来源:互联网 发布:$windows.~bt 编辑:程序博客网 时间:2024/06/09 06:58
本机ip:<%=request.servervariables
("remote_addr")%>
服务器名:<%=Request.ServerVariables
("SERVER_NAME")%>
服务器IP:<%=Request.ServerVariables
("LOCAL_ADDR")%>
服务器端口:<%=Request.ServerVariables
("SERVER_PORT")%>
服务器时间:<%=now%>
IIS版本:<%=Request.ServerVariables
("SERVER_SOFTWARE")%>
脚本超时时间:<%=Server.ScriptTimeout%>
本文件路径:<%=server.mappath
(Request.ServerVariables("SCRIPT_NAME"))%>
服务器CPU数量:<%=Request.ServerVariables
("NUMBER_OF_PROCESSORS")%>
服务器解译引擎:<%=ScriptEngine & "/"& ScriptEngineMajorVersion&"."&ScriptEngineMinorVersion&".
"& ScriptEngineBuildVersion %>
服务器操作系统:<%=Request.ServerVariables("OS")%>
支持的文件类型:<%=Request.ServerVariables("HTTP_Accept")%>
访问的文件路径:<%=Request.ServerVariables("HTTP_url")%>
用户代理的信息:<%=Request.ServerVariables("HTTP_USER_AGENT")%>
获取url中的文件名和传过来的值:request.ServerVariables("script_name")+"?"+request.ServerVariableS("QUERY_STRING")
均为网络资源的整合。。。
1、使用request.servervariables("script_name")只能获取当前文档的路径及文件名,但无法得到其后面传递的参数,如“member/detail.asp?id=123”,只能得到“member/detail.asp”,这时候可以用request.servervariables("script_name") & "?" & request.querystring("id") 来获得
一,获得网页来访者IP地址的代码是:
您的IP是: 1.<% =Request.ServerVariables("REMOTE_ADDR") %>
2. public string GetClientIP() {
string userIP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (userIP == null)
userIP = Request.ServerVariables["REMOTE_ADDR"];
return userIP;
}
二,获得操作系统版本的代码是:
<% 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 %>
---------------------------------------------------------------------
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 += "<hr/>";
info += "<br/>客户端的操作系统:" + Request.Browser.Platform;
info += "<br/>是不是win16系统:" + Request.Browser.Win16;
info += "<br/>是不是win32系统:" + Request.Browser.Win32;
return info;
----------------------------------------------------------------------
- 服务器变量的一点总结
- shell变量的一点总结
- 有关服务器,web 服务器,WEB容器的一点总结
- 指针,数组,变量参数传递的一点总结
- Win 2000 中优化 Web 服务器性能的一点总结
- javascript变量作用域一点总结
- ThreadLocal,静态变量,实例变量,局部变量的线程安全,回复:ByteBuffer 到底怎么用?网络编程中一点总结!
- ThreadLocal,静态变量,实例变量,局部变量的线程安全,回复:ByteBuffer 到底怎么用?网络编程中一点总结!
- ThreadLocal,静态变量,实例变量,局部变量的线程安全,回复:ByteBuffer 到底怎么用?网络编程中一点总结!
- 一点学习方法的总结
- UART的一点总结
- hibernate的一点总结
- pushmail的一点总结
- qt 的一点总结
- flex的一点总结
- Flex的一点总结
- Qt的一点总结
- 最近的一点总结
- 散列表
- 如何提高网站的访问速度
- JS的左右两列自动拉伸对齐
- 解决openfire在使用MySQL数据库后的中文乱码问题(转)
- C++ Virtual详解
- 服务器变量的一点总结
- 2010年11月刊
- 全面分析Java的垃圾回收机制
- BS与CS的联系与区别
- Wireshark过滤器使用规则介绍
- identifier of an instance of from 1 to 1
- linux 信号
- 转:我工作这几年 ―― 读“有多少人像这样这样苦苦挣扎”有感
- 创建了自己的运行时共享库(RSL)