安然汗蒸馆:ASP中怎样用Request.ServerVariables获取访客的系统版本和IE版本

来源:百度文库 编辑:高校问答 时间:2024/04/29 17:10:03

<%
Function Browser(Info)
Info=Request.ServerVariables("Http_User_Agent") '在这里初始化了Info,在实际应用中可以作为其他变量赋值
If InStr(Info,"MSIE 6")>0 Then
Browser="Internet Explorer 6.0"
ElseIf InStr(Info,"MSIE 5.5")>0 Then
Browser="Internet Explorer 5.5"
ElseIf InStr(Info,"MSIE 5.0")>0 Then
Browser="Internet Explorer 5.0"
ElseIf InStr(Info,"MSIE 4")>0 Then
Browser="Internet Explorer 4.0"
Else
Browser="未知的浏览器!"
End if
Response.Write "您的浏览器是:"&Browser&"<p>"
End Function

Function System(Info)
Info=Request.ServerVariables("Http_User_Agent")
If InStr(Info,"NT 5.1")>0 Then
System="Windows XP"
ElseIf InStr(Info,"NT 5.0")>0 Then
System="Windows 2000"
ElseIf InStr(Info,"NT 4")>0 Then
System="Windows NT"
ElseIf InStr(Info,"98")>0 Then
System="Windows 98"
ElseIf InStr(Info,"Me")>0 Then
System="Windows Me"
ElseIf InStr(Info,"95")>0 Then
System="Windows 95"
Else
System="未知的操作系统!"
End if
Response.Write "您的操作系统是:"&System&"<p>"
End Function

Call Browser(Info)
Call System(Info)

%>