DotNet Get User Operating System (HTTP_USER_AGENT)
- by rockinthesixstring
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