Hello World,

Windows 2000 Server, IIS 5.0.

I need to create page, which will be push file for downloading, when user
click on link.
I need to keep file location in security. Only authorized users will be able
to download file. Files for downloads located outside /wwwroot/ folder.

The big problem, which I don't know how to resolve, is: when user #1 click
on link, and "Start download" window appear on client computer, all other
connection with server are stopping handle -- server wait while user #1 will
start download, or cancel download. Also, while one user download some file,
server are not responding on other users requests. What should I do? Server
should handle in the same time at least 10 requests for downloads.

Code sample below:
Dim VPath, Path, MyStream, MyFile, MyFSO

Server.ScriptTimeout = 3600

VPath = Request.QueryString

Path = Server.MapPath ("../../" & VPath)

Set MyFSO = CreateObject ("Scripting.FileSystemObject")
Set MyFile = MyFSO.GetFile (Path)

If Err.number = 0 then

If Response.IsClientConnected Then

Set MyStream = MyFile.OpenAsTextStream (1, -1)

With Response
.Buffer = True
.ContentType = "application/binary"
.AddHeader "Content-Disposition","attachment;filename=" & MyFile.name
End With

Response.BinaryWrite MyStream.Read (1024000 / 2)
If Not Response.IsClientConnected Then
Exit Do
End If
Loop until MyStream.AtEndOfStream

Set MyStream = Nothing
End If
End if

Set MyFile = Nothing
Set MyFSO = Nothing

and also I try this code -- with the same bad result

Response.Buffer = False
Server.ScriptTimeout = 30000

Response.ContentType = "application/x-unknown"
fn = Request.QueryString

If fn = "" then
Response.Redirect ("default.asp")
End If

FPath = "G:\" & fn
Response.AddHeader "Content-Disposition", "attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
chunk = 2048
adoStream.Mode = adModeRead
adoStream.Open ()
adoStream.Type = 1
adoStream.LoadFromFile (FPath)

iSz = adoStream.Size

Response.AddHeader "Content-Length", iSz

For i = 1 To iSz \ chunk
If Not Response.IsClientConnected Then Exit For
Response.BinaryWrite adoStream.Read(chunk)

Set adoStream = Nothing


With best regards,