ho realizzato un semplice codice per scopo statistico che analizza l'HTTP_USER_AGENT e determina quale browser è che sta visitando il sito
usando questo codice mi restituisce false come se non trovasse il valore nella stringacodice:Response.Write(HUA_browser(Request.ServerVariables("HTTP_USER_AGENT")) & " ") Function HUA_browser(stringa) HUA_browser = false If Instr(stringa, "avant") <> 0 Then HUA_browser = "Avant Browser" If Instr(stringa, "curl") <> 0 Then HUA_browser = "cURL" If Instr(stringa, "dillo") <> 0 Then HUA_browser = "Dillo" If Instr(stringa, "elinks") <> 0 Then HUA_browser = "ELinks" If Instr(stringa, "emacs-w3") <> 0 Then HUA_browser = "Emacs-W3" If Instr(stringa, "epiphany") <> 0 Then HUA_browser = "Epiphany" If Instr(stringa, "galeon") <> 0 Then HUA_browser = "Galeon" If Instr(stringa, "icab") <> 0 Then HUA_browser = "iCab" If Instr(stringa, "konqueror") <> 0 Then HUA_browser = "Konqueror" If Instr(stringa, "netscape") <> 0 Then HUA_browser = "Netscape" If Instr(stringa, "omniweb") <> 0 Then HUA_browser = "OmniWeb" If Instr(stringa, "opera") <> 0 Then HUA_browser = "Opera" If Instr(stringa, "safari") <> 0 Then HUA_browser = "Safari" If Instr(stringa, "webtv") <> 0 Then HUA_browser = "WebTV" If Instr(stringa, "w3c") <> 0 Then HUA_browser = "W3C_CSS_Validator" If Instr(stringa, "camino") <> 0 Then HUA_browser = "Camino" 'estrae la versione HUA_browser = HUA_browser & Mid(stringa, (Instr(stringa, "camino/")+7), (Instr(stringa, "camino/")+10)) End If If Instr(stringa, "firefox") <> 0 Then HUA_browser = "Firefox" 'estrae la versione HUA_browser = HUA_browser & Mid(stringa, (Instr(stringa, "firefox/")+8), (Instr(stringa, "firefox/")+13)) End If If Instr(stringa, "msie") <> 0 Then HUA_browser = "MSIE" 'estrae la versione HUA_browser = HUA_browser & Mid(stringa, (Instr(stringa, "msie ")+5), (Instr(stringa, "msie ")+8)) End If 'appone ai browser basati su mozilla il nome If Instr(stringa, "gecko") <> 0 Then HUA_browser = "Mozilla / " & HUA_browser End Function
a questo punto ho modificato la parte della funzione relativa a firefox (il browser con cui sto provando) forzando la ricerca testuale nell'Instr ed a quel punto mi ha dato errore di Type mismatch![]()
stranito ho inserito copiato l'USER_AGENT e l'ho inserito in una variabile
provando la funzione con questa variabile ricevo sempre lo stesso errore...codice:prova = "Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT; rv:1.7.6) Gecko/20050318 Firefox/1.0.2"
magari è una menata ma io non ci capisco niente di quello che succede
![]()

Rispondi quotando