Working with buttons
I have a newbie question ...
I have a button on a website that needs to trigger a download when it's clicked. If I know the location of the file to be downloaded, how can I make that happen in the HTLM code.
Thanks!
[239 byte] By [
nickiii] at [2007-11-11 7:51:00]

# 1 Re: Working with buttons
Since this is the ASP.NET forum, I assume you're looking for server-side ASP.NET code? You can put code like the following in the button's server-side Click event procedure:
Response.ContentType = "application\octet-stream"
Dim FileName As String = "d:\path\filename.ext"
Dim fs As New IO.FileStream(FileName, IO.FileMode.Open)
Response.Write(fs.Length.ToString() & "#")
fs.Close()
Response.WriteFile(FileName)
Response.Flush()
Response.End()