<%=Request.ServerVariables("OS")%>
服务器名称:
<%=Request.ServerVariables("SERVER_NAME")%>
服务器IP:
<%=Request.ServerVariables("LOCAL_ADDR")%>
CPU数量:
<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>个
服务端口:
<%=Request.ServerVariables("SERVER_PORT")%>
Webserver及版本:
<%=Request.ServerVariables("SERVER_SOFTWARE")%>
脚本解释引擎:
<%=ScriptEngine &"/"&ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."&ScriptEngineBuildVersion %>
服务协议及版本:
<%=Request.ServerVariables("SERVER_PROTOCOL")%>
脚本超时时间:
<%=Server.ScriptTimeout%>秒
网站物理路径:
<%=request.ServerVariables("APPL_PHYSICAL_PATH")%>
<%
Dim BrowseMsg,BrowseVersion,SystemVersion
BrowseMsg=Request.ServerVariables("HTTP_USER_AGENT")
'+++++++++++一个基本判别操作系统的函数+++++++++++
Function SystemCheck()
if inStr(BrowseMsg,"Windows 98") then
SystemCheck="Windows 98"
else if inStr(BrowseMsg,"Windows NT 4.0") then
SystemCheck="Windows NT 4.0"
else if inStr(BrowseMsg,"Windows NT 5.0") then
SystemCheck="Windows NT 2000"
else
SystemCheck="未知类型"
end if
end if
end if
end Function
'由于时间的原因我没有写判定win95和windows xp的语句,感兴趣的网友可以
'自行添加:)
'+++++++++++结束+++++++++++
if inStr(BrowseMsg,"MSIE") then
SystemVersion=CInt(Mid(BrowseMsg,inStr(BrowseMsg,"MSIE")+5,1))
response.write "您的浏览器的版本是 IE"&BrowseVersion&"<BR>"
response.write "您的操作系统是 "&SystemCheck()
end if
%>
楼主,ASP与ASP.NET原理上没多大差异,以上这段代码(经测试)完全可以在ASP.NET中使用。
测试代码:
-------------------------------------------------------
<%
if left(Request.ServerVariables("REMOTE_ADDR"),9)="10.75.19." or Request.ServerVariables("REMOTE_ADDR")="10.75.30.246" or Request.ServerVariables("REMOTE_ADDR")="10.75.30.247" or Request.ServerVariables("REMOTE_ADDR")="10.75.30.249" or Request.ServerVariables("REMOTE_ADDR")="10.75.30.250" or Request.ServerVariables("REMOTE_ADDR")="10.75.30.251" or Request.ServerVariables("REMOTE_ADDR")="10.75.30.252" or Request.ServerVariables("REMOTE_ADDR")="10.75.169.191" or Request.ServerVariables("REMOTE_ADDR")="10.75.169.192" or Request.ServerVariables("REMOTE_ADDR")="10.75.169.193" or Request.ServerVariables("REMOTE_ADDR")="10.75.159.228" or Request.ServerVariables("REMOTE_ADDR")="10.75.159.129"or Request.ServerVariables("REMOTE_ADDR")="172.16.110.60" or Request.ServerVariables("REMOTE_ADDR")="172.16.110.62" or Request.ServerVariables("REMOTE_ADDR")="10.75.159.227" or Request.ServerVariables("REMOTE_ADDR")="10.75.159.229" or left(Request.ServerVariables("REMOTE_ADDR"),12)="10.75.159.23" or Request.ServerVariables("REMOTE_ADDR")="172.16.115.156" or left(Request.ServerVariables("REMOTE_ADDR"),12)="10.75.159.51" or left(Request.ServerVariables("REMOTE_ADDR"),12)="10.75.155.18" or left(Request.ServerVariables("REMOTE_ADDR"),12)="10.75.155.19" or Request.ServerVariables("REMOTE_ADDR")="10.75.159.219" or left(Request.ServerVariables("REMOTE_ADDR"),11)="10.75.41.17" or left(Request.ServerVariables("REMOTE_ADDR"),11)="10.75.41.18" or left(Request.ServerVariables("REMOTE_ADDR"),11)="10.75.41.19" or left(Request.ServerVariables("REMOTE_ADDR"),11)="10.75.16.173" or left(Request.ServerVariables("REMOTE_ADDR"),11)="10.75.41.43"or left(Request.ServerVariables("REMOTE_ADDR"),11)="10.75.41.47" or left(Request.ServerVariables("REMOTE_ADDR"),11)="10.75.41.47" then
Response.Write("IP Address is passed")
Else
Response.Write("IP Address Can not be passed!")
End IF
%>
------------------------------------------------------------------------
测试结果:
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)