Buongiorno, propongo un problema gia postato su altri forum, ma a cui nessuno ha ancora saputo darmi una risposta :

Sto preparando una funzionalità per eliminare un problema di url injection su una vecchia applicazione fatta in classic ASP.

Alla funzione viene passato una parte di url (es. CartellaA/CartellaB/file.asp) che viene completata con le informazioni delle server variables e fa una richiesta http verso questo indirizzo.

Il problema è che nel mio ambiente di sviluppo non mi da problemi di alcuna sorta, su server di Test invece da l'errore

Description :The data necessary to complete this operation is not yet available
Error Source : msxml3.dll
Error number -2147483638

Questa è la mia funzione

Function FindPage(extendedUrl, redirect)

On Error Resume Next

dim straddr, url, protocol, status, virtualDir, rState

If extendedUrl = "" Then
FindPage = extendedUrl
Else

If Request.ServerVariables("HTTP_HOST") <> "" Then
straddr = Replace(Request.ServerVariables("HTTP_HOST"), "/", "")
Else
straddr = Replace(Request.ServerVariables("SERVER_NAME"), "/", "")
End If

virtualDir = Request.ServerVariables("PATH_INFO")
i = InStr(2, virtualDir, "/")

If i > 0 Then
virtualDir = Left(virtualDir, i - 1)
virtualDir = Replace(virtualDir, "/", "") & "/"
Else
virtualDir = ""
End If

protocol = LCase(Split(Request.ServerVariables("SERVER_PROTOC OL"), "/")(0))
url = protocol & "://" & straddr & "/" & virtualDir & extendedUrl

set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlhttp.open "GET", url, false

xmlhttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "Content-length", 0

xmlhttp.send

status = CInt(xmlhttp.Status)
rState = xmlhttp.readyState

If xmlhttp.readyState = 4 Then
If status >= 400 and status < 500 Then
FindPage = redirect
Else
FindPage = extendedUrl
End If
End If

set xmlhttp = nothing

End if

If err.Number <> 0 Then

Response.Write "
Errore in FindPage!
"
Response.Write "Description : " & err.Description & "
"
Response.Write "Error source : " & err.Source & "
"
Response.Write "Error number " & err.Number & "
"
Response.Write "Url : " & url & "
"
Response.Write "HTTP_HOST :" & Request.ServerVariables("HTTP_HOST") & "
"
Response.Write "SERVER_NAME :" & Request.ServerVariables("SERVER_NAME") & "
"
Response.Write "readyState : " & rState & "
"
Response.Write "Response Text : " & xmlhttp.responseText & "
"
Response.End

End If

End Function


L'errore credo di aver capito che si propone quando cerco di andare a leggere le proprietà dell'oggetto xmlhttp. Cercando tra il mare di forum in rete sembra che chi ha avuto questo problema aveva messo "true" all' argomento "async" della funzione Open di xmlhttp. Modificandolo in false sembra che vada sempre a posto.
Questo avrebbe senso, se il server è impegnato al momento non da subito la risposta e non valorizza xmlhttp. Ma nella mia funzione "async" è false, e ottengo lo stesso errore. Com'è possibile ? Forse ci sono dei settaggi particolari su IIS (io ho il 7.5, su test c'è il 6)? Oppure sto usando un oggetto COM errato (qui ""MSXML2.ServerXMLHTTP.3.0", ma ho provato anche con "Microsoft.XMLHTTP" e mi da l'errore "the system cannot locate the resource specified") ?
Non so esattamente dove sbattere la testa ...

Grazie in anticipo.