Ciao a tutti con l'esigenza di far scaricare delle immagini che risiedono su un server differente rispetto a quello dove risiede un sito (con l'intenzione di nascondere all'utente finale dove avviene lo storage delle immagini ad alta definizione) ho implementato questo codice - funzionante - che preleva l'immagine dal secondo server, lo sposta in una cartella del server dove risiede il sito e, dopo il download forzato, cancella lo stesso file.
Questo è il codice:

<%
Function DownloadFile(strURL)
Dim XMLHTTP
Set XMLHTTP = Server.CreateObject("MSXML2.XMLHTTP")
XMLHTTP.Open "GET", strURL, False
XMLHTTP.Send()
strBinaryData = XMLHTTP.ResponseBody
DownLoadFile=strBinaryData
End Function

Function SaveFile(sFileName, sFileContents)
Dim TextStream
Dim File
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set TextStream = objFSO.CreateTextFile(sFileName)
TextStream.WriteLine (sFileContents)
TextStream.Close
End Function


Function RSBinaryToString(xBinary)
Dim Binary
If VarType(xBinary)=8 Then Binary = MultiByteToBinary(xBinary) Else Binary = xBinary
Dim RS, LBinary
Const adLongVarChar = 201
Set RS = CreateObject("ADODB.Recordset")
LBinary = LenB(Binary)
If LBinary>0 Then
RS.Fields.Append "mBinary", adLongVarChar, LBinary
RS.Open
RS.AddNew
RS("mBinary").AppendChunk Binary
RS.Update
RSBinaryToString = RS("mBinary")
Set RS=Nothing
Else
RSBinaryToString = ""
End If
Set RS=Nothing
End Function

Function MultiByteToBinary(MultiByte)
Dim RS, LMultiByte, Binary
Const adLongVarBinary = 205
Set RS = CreateObject("ADODB.Recordset")
LMultiByte = LenB(MultiByte)
If LMultiByte>0 Then
RS.Fields.Append "mBinary", adLongVarBinary, LMultiByte
RS.Open
RS.AddNew
RS("mBinary").AppendChunk MultiByte & ChrB(0)
RS.Update
Binary = RS("mBinary").GetChunk(LMultiByte)
End If
Set RS = Nothing
MultiByteToBinary = Binary
End Function

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8


myfile = DownloadFile("http://www.google.com/images/logo.gif")
SaveFile server.mappath("/public/logo.gif"), RSBinaryToString(myfile)

Const adTypeBinary = 1
Const adReadAll = -1
fname = "logo.gif"
myFILE = Server.MapPath("/public/logo.gif")
set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.Open
objStream.LoadFromFile myFILE
Response.Expires = 0
Response.Buffer = true
Response.ContentType = "application/octet-stream"
Response.Addheader "Content-Disposition", "attachment; filename=" & fname
Response.Addheader "Content-Length", objStream.size
Response.BinaryWrite(objStream.Read(adReadAll))
objStream.Close
set objStream = nothing

Set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"\public\logo.gif")
Set fso = Nothing

Response.End
%>


Ma, secondo voi, è la soluzione più semplice e soprattutto efficace?
Grazie