Qual è il sistema operativo del server? - Script ASP
Tra le variabili server messe a disposizione da ASP ne esiste una in grado di restituire informazioni sul software del server.
Parliamo della variabile Request.ServerVariables("SERVER_SOFTWARE") che se stampata da una pagina ASP su un pc con sistema operativo Windows XP restituisce, ad esempio, una stringa del tipo Microsoft-IIS/5.1.
Realizziamo una funzione per individuare i possibili sistemi operativi.
<%
public function getServerOS()
Dim strServer
Dim strServerSoftware
' Attribuisce alla variabile il valore della Variabile Server
strServerSoftware = Request.ServerVariables("SERVER_SOFTWARE")
' Controlla il valore di IIS
' univoco per ogni sistema operativo
if Instr(strServerSoftware, "IIS/4") > 0 then
strServer = "Microsoft Windows NT"
elseif Instr(strServerSoftware, "IIS/5.0") > 0 then
strServer = "Microsoft Windows 2000"
elseif Instr(strServerSoftware, "IIS/5.1") > 0 then
strServer = "Microsoft Windows XP"
elseif Instr(strServerSoftware, "IIS/6") > 0 then
strServer = "Microsoft Windows 2003"
end if
' Valore di ritorno della funzione
getServerOS = strServer
end function
' Stampa a video il valore
Response.Write(getServerOS())
%>

