siccome sappiamo tutti quanto sono dannosi i reload per i server
volevo sapere se esiste un modo per caricare una pagina asp ogni 30 secondi senza fare un reload...
questo è il mio codice che si occupa della gestione delle connessioni e dell'esistenza o meno di nuovi messaggi privati che in realtà ogni 25 secondi fa il reload e interroga il database...come potrei ovviare al problema reload?
codice:
<%on error resume next%>
<html>
<head>
<META HTTP-EQUIV="refresh" CONTENT="25;URL=logout.asp">
</head>
<body>
<%
' log out di tutti gli utenti
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("../databb/data.mdb")
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="Select * from Iscritti"
rs.Open sql , Conn ,3 ,3
do while not rs.eof
if rs("Status_Connect")=true then
if rs("ID")=Session("ID") then
rs("Status_Connect")= True
rs("Date_Now")= Now()
Session("ID")=rs("ID")
else
if DateDiff("s",rs("Date_Now"),Now())>240 then
rs("Status_Connect")= False
rs("Date_Now")= []
end if
end if
end if
rs.MoveNext
loop
rs.close
if IsNumeric(session("ID")) and Session("ID")<>"" then
sql="Select * from Iscritti inner join miniblog on Iscritti.ID=miniblog.ID_Destinatario where miniblog.ID_Destinatario="&Session("ID") & " AND Iscritti.Status_Connect=true and Check=false"
rs.Open sql , Conn ,3 ,3
x=0
Do while not rs.eof
if DateDiff("s",rs("Data_Messaggio"),Now())<25 then
%>
<script>
top.window.open('ricevi.asp?ID=<%=rs("ID")%>&delete=True','','width=400,height=300')
</script>
<%
end if
rs.MoveNext
loop
end if
set rs=Nothing
Conn.close
Set Conn=nothing
%>
</body>
</html>
<%
if err.number<>0 then
errore = "Descrizione Errore -->" & err.description & "\n"
errore = errore & "Numero Errore -->" & err.number & "\n"
errore = errore & "Sorgete dell'Errore -->" & err.source & "\n"
errore = replace(errore,"'" ,"")
err.clear
%>
<script type="text/javascript">
// top.window.alert('<%=errore%>')
</script>
<%
end if
%>
grazie