Anche così non funziona.
Mi da errore nella riga hit.Analyze()
il codice del metodo Analyze() è questo
codice:
Public Sub Analyze()
Dim ASPSession as String
Dim Agente as String
Dim IPUtente as String
Dim Duratavisita as Integer
Dim Npagine as Integer
Dim Data as Datetime
Dim Country as Countrylookup.CountryLookup = New Countrylookup.Countrylookup(httpContext.Current.Server.Mappath("data/GeoIP.dat"))
Dim Paese as String
Dim myconn as New Oledbconnection(System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_stats"))
Dim mycomm as new OledbCommand("Select Sessione, Agente, IPUtente From RawStats Where Elaborato=0 and Tempo<Date() and IPUtente not in (Select IP from IPFilters) Group By Sessione, Agente, IPUtente", myconn)
myconn.open()
Dim myread as OLEDBDataReader=mycomm.executereader()
While myread.read()
ASPSession=myread.getvalue(0)
Agente=myread.getvalue(1)
IPUtente=myread.getvalue(2)
Browser(Agente,ASPSession)
DurataVisita=Durata(ASPSession)
NPagine=CountPage(AspSession)
Data=getDate(AspSession)
Paese="N/A"
'httpContext.Current.response.write(getHostname(IPUtente) & "
")
'httpContext.Current.response.write(getReferrer(ASPSession) & "
")
If (Not Instr(IPUtente,"192.168")>0) and (Not InStr(IPUtente,"10.")>0) then Paese= Country.LookupCountryName(IPUtente)
Dim myconn2 as New Oledbconnection(System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_stats"))
Dim inscomm as new OledbCommand("insert Into Visite (Aspsession,Data,durata,npagine,idbrowser,idos,Paese,IPAddress) VALUES (@ASPSes,@Data,@Durata,@NPagine,@IDBw,@IDOS,@Paese,@IPAddress)", myconn2)
myconn2.open()
inscomm.Parameters.Add("@ASPSes", OLEDBType.varchar,255)
inscomm.Parameters("@ASPSes").value=ASpSession
inscomm.Parameters.Add("@Data", OLEDBType.date)
inscomm.Parameters("@Data").value=Data
inscomm.Parameters.Add("@Durata", OLEDBType.integer)
inscomm.Parameters("@Durata").value=DurataVisita
inscomm.Parameters.Add("@NPagine", OLEDBType.integer)
inscomm.Parameters("@NPagine").value=Npagine
inscomm.Parameters.Add("@IDBw", OLEDBType.integer)
inscomm.Parameters("@IDBw").value=BwID
inscomm.Parameters.Add("@IDOS", OLEDBType.integer)
inscomm.Parameters("@IDOS").value=OSID
inscomm.Parameters.Add("@Paese", OLEDBType.varchar,255)
inscomm.Parameters("@Paese").value=Paese
inscomm.Parameters.Add("@IPAddress", OLEDBType.varchar,255)
inscomm.Parameters("@IPAddress").value=IPUtente
inscomm.executenonquery
Dim upcomm as New OledbCommand("Update RawStats Set Elaborato=-1 Where Sessione=@ASPSes", myconn2)
upcomm.Parameters.Add("@ASPSes", OLEDBType.varchar,255)
upcomm.Parameters("@ASPSes").value=ASpSession
upcomm.executenonquery()
myconn2.close()
end while
myconn.close()
end sub
che funziona se richiamato da una pagina aspx
P.S. ti era scappata un s di troppo in questa riga
Application_OnStart(Object s,EventArgs s)