Click to See Complete Forum and Search --> : Detecting users OS


toastg
10-13-2003, 11:14 PM
Hello All,
I want to use response.write to write to a page that diplays the users Operating System. something like : winnt4 or windows 2000 - windows 95.... you get the picture. Can I use the All_HTTP servervariable to get the OS version... then have the response.write write it to the page? How would it be written without all th other info it brings back? Or is there a better way to do this? any help would be greatly appriciated....

rdoekes
10-15-2003, 03:15 AM
The Request.ServerVariables("HTTP_USER_AGENT") gives you all information about the browser, including the operating system. something like this:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;)

This string you can parse and filter

toastg
10-15-2003, 09:17 AM
sounds good - how would i parse just the Windows NT 5.0 info then response.write it to a page

rdoekes
10-15-2003, 09:26 AM
Dim strOS
strOS = Request.ServerVariables("HTTP_USER_AGENT")
If inStr(strOS, "Windows NT 5.0") > 0 Then
Response.Write "win2000"
ElseIf InStr(strOS, "Windows 98") > 0 Then
Response.Write "win 98"
ElseIf Instr(strOS, "Windows NT 5.1") > 0 Then
Response.Write "win XP"
Else
Response.Write "no windows OS"
End If

toastg
10-15-2003, 09:49 AM
thank you so much for your time and help... i'll give it a try