Welcome to WebmasterWorld Guest from 54.205.17.36

Forum Moderators: ocean10000

Message Too Old, No Replies

Downloading files using asp

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

New User

10+ Year Member

joined:Mar 23, 2003
posts:7
votes: 0


Hi,

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.Open
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

Denis

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 13, 2002
posts:2162
votes: 0


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
objXMLParser.send
getURI = objXMLParser.responseText
end function
7:08 pm on Aug 19, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 23, 2003
posts:7
votes: 0


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..

Denis

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 16, 2003
posts:897
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 13, 2002
posts:2162
votes: 0


<%
strPage="http://www.whatever......."
Response.Write GetURI (strPage)
%>
10:03 am on Aug 20, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 23, 2003
posts:7
votes: 0


Hi,

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

Thanks for the reply aspdaddy..:-)

Denis

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members