DotNet Get User Operating System (HTTP_USER_AGENT)
Posted
by rockinthesixstring
on Stack Overflow
See other posts from Stack Overflow
or by rockinthesixstring
Published on 2010-03-14T16:58:26Z
Indexed on
2010/03/14
17:05 UTC
Read the original article
Hit count: 167
operating-system
|ASP.NET
I'm looking at building an exhaustive function that returns a friendly name for the Users Operating System.
I think I have most of the Windows stuff down, but I'm not sure about Linux, OSX, and others.
Does anyone know where I can find an exhaustive list of HTTP_USER_AGENT
's
'Gets the users operating system
Public Shared Function GetUserOS() As String
Dim strAgent As String = HttpContext.Current.Request.ServerVariables("HTTP_USER_AGENT")
'Windows OS's
If InStr(strAgent, "Windows NT 6.1") Then : Return "Windows 7"
ElseIf InStr(strAgent, "Windows NT 6.0") Then : Return "Windows Vista"
ElseIf InStr(strAgent, "Windows NT 5.2") Then : Return "Windows Server 2003"
ElseIf InStr(strAgent, "Windows NT 5.1") Then : Return "Windows XP"
ElseIf InStr(strAgent, "Windows NT 5.0") Then : Return "Windows 2000"
ElseIf InStr(strAgent, "Windows 98") Then : Return "Windows 98"
ElseIf InStr(strAgent, "Windows 95") Then : Return "Windows 95"
'Mac OS's
ElseIf InStr(strAgent, "Mac OS X") Then : Return "Mac OS X"
'Linux OS's
ElseIf InStr(strAgent, "Linux") Then : Return "Linux"
Else : Return "Unknown"
End If
End Function 'GetUserOS
© Stack Overflow or respective owner