'************************************** ' Name: Simple Download Method with Stre ' ams ' Description:Enables you to put a certa ' in degree of protection in files availab ' le for download in you IIS Server by mak ' ing them inaccessible by a direct URL. H ' ides them in other directory, out of www ' root. ' By: Daniel Verzellesi (from psc cd) ' ' ' Inputs:Pass the file name. ' ' Returns:Get the file written in binary ' format into Request. ' 'Assumes:None ' 'Side Effects:None '************************************** <% '-- DOWNLOAD.ASP ' '-- Simple Download Method with Streams ' Daniel Verzellesi ' ' As an example I'm getting the file I want to download ' from the Request (//.../dowload.asp?fname=myfile1.doc). ' You can change it to get the file name from a DB or ' anything else... ' Dim p, st, f '-- my "secret" path p = "c:\files\" '-- file name f = Request.QueryString("fname") '-- get file into stream Set st = CreateObject("ADODB.Stream") st.Open st.Type = 1 'binary st.LoadFromFile p & f '-- send stream to response Response.ContentType = "application/my-download" Response.AddHeader "Content-Disposition", "attachment; filename=""" & f & """" Response.BinaryWrite st.Read(-1) 'read all Response.End '-- close the stream set st = nothing %>