Spero non sia considerato crossposting visto che avevo gia fatto questa domanda alla fine di un'altro post ma il titolo non si addiceva.

Ho utilizzato questo script preso da un'esempio sul forum per paginare il risultato di una ricerca utenti dal Db,funziona tutto quasi correttamente cioè appena entro nella pagina mi visualizza i primi 5 risultati ma non sono giusti,solo dopo aver visitato la 2 pagina tornando alla 1 i risultati sono giusti....
Questo penso perche non viene recuperato il valore della pagina.
Appena visualizza la pagina l'indirizzo è"http://localhost/miosito/risultato_ricerca.asp" visalizzando la 2 diventa "http://localhost/miosito/risultato_ricerca.asp?page=2" e tornando alla 1 "http://localhost/miosito/risultato_ricerca.asp?page=1"solo a questo punto i risultati sono corretti.
Ho anche provato sull'action del form nella pagina precedente a mettere:
method="post" action="risultato_ricerca.asp?page=1" ma il risultato non cambia.
Grazie



codice:
<%@LANGUAGE="VBSCRIPT"%> 
 
<% response.buffer=true %> 
<% Server.ScriptTimeout = 300 %> 
<% 
dim objConn 
set objConn = server.createobject("ADODB.Connection") 
objConn.open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = "&_ 
Server.MapPath("\mdb-database\utenti.mdb") 
sel_ses = request.form("sesso") 
sel_reg = request.form("Reg_res") 
sel_prov = request.form("Prov_res") 

Dim strRicerca 
if sel_ses = "" and sel_reg = "Tutte" and sel_prov = "Tutte" then 
strRicerca = " ORDER BY Username" 
else 
if sel_ses = "" and sel_reg <> "Tutte" and sel_prov = "Tutte" then 
strRicerca = " WHERE [Regione residenza] = '"& sel_reg &"' ORDER BY Username" 
else 
if sel_ses <> "" and sel_reg = "Tutte" and sel_prov = "Tutte" then 
strRicerca = " WHERE Sesso = '"& sel_ses &"' ORDER BY Username" 
else 
if sel_ses <> "" and sel_reg <> "Tutte" and sel_prov = "Tutte" then 
strRicerca = " WHERE sesso ='"& sel_ses &"' AND [Regione residenza] ='"& sel_reg &"' ORDER BY Username" 
else 
if sel_ses <> "" and sel_reg <> "Tutte" and sel_prov <> "Tutte" then 
strRicerca = " WHERE Sesso = '"& sel_ses &"' AND [Regione residenza] ='"& sel_reg & "' AND [Provincia residenza] ='"& sel_prov & "' ORDER BY Username" 
end if 
end if 
end if 
end if 
end if 

iPageSize = 5 'NUMERO RECORD PER PAGINA 

If Request.QueryString("page") = "" Then 
iPageCurrent = 1 
Else 
iPageCurrent = CInt(Request.QueryString("page")) 
End If 


dim objRS, strSQL 
set objRS = server.createobject("ADODB.Recordset") 
strSQL = "SELECT * FROM tab_utenti" 
strSQL = strSQL & strRicerca 
objRS.PageSize = iPageSize 
objRS.CacheSize = iPageSize 
objRS.open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText 

reccount = objRS.recordcount 
iPageCount = objRS.PageCount 
%> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
<head> 
@import url("ley_2.css"); 
a#viewcss{color: #00f;font-weight: bold} 
</style> 
<script type="text/javascript" src="script_regioni.js"> 
</script> 
</head> 
<body> 
<table cellpadding="0" cellspacing="0" border="0" width="95%"> 
<tr> 
<td bgcolor="#cccccc"> 
<table cellpadding="2" cellspacing="1" border="0" width="100%"> 
<%If iPageCurrent > iPageCount Then iPageCurrent = iPageCount 
If iPageCurrent < 1 Then iPageCurrent = 1 

If iPageCount = 0 Then 
Response.Write "

<table><td><font face='verdana' size='2' color='#000000'>Nessuna ricerca per le tue scelte.</td></table></p>" 
Else 
objRS.AbsolutePage = iPageCurrent 
iRecordsShown = 0 
%> 
<% 
'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL 
'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA 
cont=1 
Do While iRecordsShown < iPageSize And Not objRS.EOF 
Dim Rig, bg 
Rig = Rig + 1 
If Rig Mod 2 = 0 then 
bg = "#E4E4E4" 
Else 
bg = "#ccccff" 
End if 
Response.Write "<tr bgcolor = " & bg & "><td><font color='#000000' face='Verdana' size='1'>" & (iPageSize*iPageCurrent)-iPageSize+Cont & "</font></td>" 

Response.Write "<td>"%>[img]..\file/<%=objRS([/img]"></td> 
<% 
Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>"%><a href="profilo.asp?utente=<%=objRS("Username")%>"><%=objRS("Username")%></font></td> 
<% 
Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>" & objRS("Hobby") & "</font></td>" 
Cont = Cont + 1 
'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB 
iRecordsShown = iRecordsShown + 1 
objRS.MoveNext 
Loop 
'PULIZIA DEGLI OGGETTI ADO 
objRS.Close 
Set objRS = Nothing 
%> 
</table> 
</td> 
</tr> 
</table> 
<%End if%> 

<%If ipagecount <> 1 Then%> 
<center> 
<table> 
<tr valign="middle"> 
<td width="50%" align="center" valign="middle"><font face="verdana" size="1" color="#000000"> 
[ 
<%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%> 
 [img]images/first.gif[/img]  
<%end if%> 
<%if iPageCurrent > 1 then%> 
 [img]images/pre.gif[/img]  
<%end if%> 
<%if iPageCount > 2 then 
if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2 
if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2 
else 
da_pag = 1 
fino_a_pag = iPageCount 
end if%> 
<%for i = da_pag to fino_a_pag%> 
<%if i = iPageCurrent then%> 
 <font color="red"><%=i%></font>  
<%else%> 
 <%=i%>  
<%end if%> 
<%next%> 
<%if iPageCurrent > 0 and iPageCurrent < iPageCount then%> 
 [img]images/next.gif[/img]  
<%end if%> 
<%if iPageCurrent+1 < iPageCount then%> 
 [img]images/last.gif[/img]  
<%end if%> 
] 
</font></td> 
</tr> 
<tr> 
<td colspan="2" align="center"><font face="verdana" size="1" color="#000000"> 
<center> 
Pagina  
<font color="#FF0000"><%=iPageCurrent%></font> 
 di  
<font color="#FF0000"><%=iPageCount%></font> 
</center> 
</font></td> 
</tr> 
</table> 
</center> 
<%end if%> 
<% 
objConn.Close 
Set objConn = Nothing 
%> 

</body> 
</html>