You can tell it the filename by added this header just before you do the write:
Response.AddHeader("Content-Disposition", "attachment;filename=test.aaa")
Ken
MVP [ASP.NET]
--
Microsoft MVPs have a question for *you*: Are you patched against the Worm?
http://www.microsoft.com/security/se...s/ms03-026.asp
"mandelbort" <> wrote in message
news:...
Hi, i'm tryng to make a asp.net file manager to download files that are on a
server;
supposing i want to download the file c:\test\test.aaa, the code i have
written is:
#########################################
Dim fStream As New System.IO.FileStream(path & file, _
IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
Dim b(fStream.Length) As Byte
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/unknown"
fStream.Read(b, 0, fStream.Length)
Response.BinaryWrite(b)
Response.End()
fStream.Close()
fStream = Nothing
#####################################
this method works fine, but there are 2 problems:
1. when the dialog for file saving appears, it prompt to save a file with
the name of the aspx page, and not with the name of the file being
downloaded;
2. i suppose that it is not very efficient to open the file with filestream,
copy it into a byte array and then output it to the page: there is some
method more efficient??
Thanks, Mik