Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

Downloading files using asp

10:49 pm on Aug 17, 2003 (gmt 0)

10+ Year Member


I use the following code in order for my clients to have access in my files without viewing the complete url.
Function getBinaryFile(fileSpec)
Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = Server.Createobject("ADODB.Stream")
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile = oStream.Read
set oStream = Nothing
End Function
strFullURL = "the url"
strFileName = Request.QueryString("name")
Response.ContentType = "application/x-unknown"
Response.AddHeader "Content-Disposition","attachment; filename=" & chr(34) & strFileName & chr(34)
Response.BinaryWrite getBinaryFile(strFullURL & strFileName)
However when I put the files on a different server than the one where the site resides, the script can't work and I get an error message which says that the IE can't find the web page. I noticed also that can't recognize the file format also as in the case when the files are in my server.

Any ideas?
Thanks for your attention


5:40 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

If I understand, you want to display pages without the user knowing the url?

To do this, you can use the m/s xml component:

function getURI( byval strURI )
dim objXMLParser
set objXMLParser = server.CreateObject("Microsoft.XMLHTTP")
objXMLParser.open "GET", strURI, false
getURI = objXMLParser.responseText
end function
7:08 pm on Aug 19, 2003 (gmt 0)

10+ Year Member

Thanks for the answer..
The hiding of the url is one part of my question.
The other is how to achieve to make the downloading of the files which reside in another server and not in mine, available..

However I am interested in your solution about the xml component..

Could you give me an example using this component with a hypothetical url..

Sorry for asking this but I am not an ASP expert..:-)

Waiting for your answer..

Thanks in advance..


7:58 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Hey dimoss,

why don't you put that file on the other server as well and call it from your main server. That way you can feed the results into your current page and then handle them like a string.

11:07 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Response.Write GetURI (strPage)
10:03 am on Aug 20, 2003 (gmt 0)

10+ Year Member


I tried to put the file on the other server but it didn't worked either..

Thanks for the reply aspdaddy..:-)



Featured Threads

Hot Threads This Week

Hot Threads This Month