Hi,
That's exactly what I needed and it works great.
Thanks for the help.
Ken
"Mona" <mo**@discussion.com> wrote in message news:eV**************@TK2MSFTNGP15.phx.gbl...
Hi Kenneth,
In order to download files to a user machine you can use the following code snippet to do so:
Dim FilePath As String = Server.MapPath("abc.txt")
& nbsp;Dim TargetFile As New System.IO.FileInfo(FilePath)
' clear the current output content from the buffer
Response.Clear()
' add the header that specifies the default filename for the Download/
' SaveAs dialog
Response.AddHeader("Content-Disposition", "attachment; filename=" + _
TargetFile.Name)
' add the header that specifies the file size, so that the browser
' can show the download progress
Response.AddHeader("Content-Length", TargetFile.Length.ToString())
' specify that the response is a stream that cannot be read by the
' client and must be downloaded
Response.ContentType = "application/octet-stream"
' send the file stream to the client
Response.WriteFile(TargetFile.FullName)
' stop the execution of this page
Response.End()
HTH
Mona[Grapecity]
"Kenneth Windish" <ke************@netzero.net> wrote in message news:%2***************@TK2MSFTNGP15.phx.gbl...
Hi,
This has probably been discussed before, but I have been unable to find
anything on it, except an article written in C or C+, or C# and not in VB.
How can I download a file from my web page to a client?
Thanks in advance.
Ken