[codebox]<%Option Explicit%>
<meta name=”robots” content=”noindex, nofollow”>
<%
Dim strURL, strUserName, strPassWord
strURL = "http://mysite.com/word.doc"
struserName = "username"
strPassWord = "password"
Dim objXMLHTTP
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
Call objXMLHTTP.Open("GET", strURL, False, strUserName, strPassword)
Call objXMLHTTP.Send()
If objXMLHTTP.Status <> 200 Then
Response.Write(objXMLHTTP.responseText)
Set objXMLHTTP = Nothing
Else
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition", "attachment; filename=""word.doc"""
Response.Charset = "UTF-8"
Response.BinaryWrite(objXMLHTTP.responseBody)
Set objXMLHTTP = Nothing
End If
%>[/codebox]
if I change the application/msword to application/pdf and look to a pdf file it works great. Unfortunately I need to be able to access word files as well as Excel Files, Images and PDF's.
Is there a way to make this code universal, or will I have to look at using getpdf, getdoc, getxls, etc. Thanks,
-Matt McCracken
Edited by Immortalarena, 07 October 2009 - 09:31 PM.