I am trying to allow a web user to download a file that exists in a
protected directory.
If I use the following sub, the contents of the file are written to the web
page, instead of prompting the user to save the file.
What am I doing wrong?
-R
Sub doDownload()
Response.ContentType = "application\msword"
Dim filename As String = New String("c:\\Temp\\myDownload\\hi.doc")
Dim downloadFile As System.IO.FileStream = New
System.IO.FileStream(filename, IO.FileMode.Open)
Response.Write(downloadFile.Length() & "#")
downloadFile.Close()
Response.WriteFile(filename)
Response.Flush()
Response.End()
End Sub