所以我有以下代码,我想用它来下载图像并保存它们。
<%
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
%>
当我在网络上运行此图片时,它运行正常。但是,当尝试在需要NT身份验证的Intranet图像上使用它时,我使用response.write objXMLHTTP.Status
所以我的一个显而易见的问题是 - 如何在不取消NT身份验证的情况下在脚本中进行此操作?
无论其
这也可能是由于图像没有扩展名。它们的格式为http://domain/thumbs/image1
,而不是http://domain/thumbs/image1.png
无论哪种方式,我都无法让它发挥作用!
由于
答案 0 :(得分:0)
http://msdn.microsoft.com/en-us/library/ms763809%28v=vs.85%29.aspx
objXMLHTTP.open(bstrMethod, bstrUrl, bAsync, bstrUser, bstrPassword);