So I have the following code which I want to use in order to download images and save them.
<%
function SaveFileFromUrl(Url, FileName)
dim objXMLHTTP, objADOStream, objFSO
Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")
objXMLHTTP.open "GET", Url, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 OR objXMLHTTP.Status = 304 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the start
Set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(FileName) Then objFSO.DeleteFile FileName
Set objFSO = Nothing
objADOStream.SaveToFile FileName
objADOStream.Close
Set objADOStream = Nothing
SaveFileFromUrl = objXMLHTTP.getResponseHeader("Content-Type")
else
SaveFileFromUrl = ""
End if
response.write objXMLHTTP.Status
Set objXMLHTTP = Nothing
end function
%>
When I run this on images from the web, it works fine. However when trying to use it on intranet images that need NT authentication, I get a 401 error back by using response.write objXMLHTTP.Status
So my somewhat obvious question is - how do I go about this in the script without taking off NT authentication?
HOWEVER
It may also be due to the fact that the images do not have an extension. They are in the form http://domain/thumbs/image1
rather than http://domain/thumbs/image1.png
Either way, I can't get it to work!
Thanks