Hello,
The customer wants to download a music file for a path that is on the server, then play that in the web form. So it will be like having window media player embedded in the web form itself.
I have the code for downloading and playing. However, a dialog will popup and when they click open it will play the music. However, the customer doesn't like this and want to play the music in a player that is in the web page itself.
Here is my code so far for downloading and playing the music.
Many thanks
The customer wants to download a music file for a path that is on the server, then play that in the web form. So it will be like having window media player embedded in the web form itself.
I have the code for downloading and playing. However, a dialog will popup and when they click open it will play the music. However, the customer doesn't like this and want to play the music in a player that is in the web page itself.
Here is my code so far for downloading and playing the music.
Many thanks
Code:
Try
Dim fs As FileStream = Nothing
Dim contentType As String = String.Empty
'Dim path As String = "\\10.10.10.31\Inetpub\[URL unfurl="true"]wwwroot\csone\images\Content\"[/URL]
'Dim fileName As String = "Voice.mp3"
Dim path As String = "C:\DownloadPicture\"
Dim fileName As String = "Beethoven.wma"
fs = File.Open(path & fileName, FileMode.Open)
Dim fileBytes(fs.Length) As Byte
fs.Read(fileBytes, 0, fs.Length)
fs.Close()
Response.AddHeader("Content-disposition", "attachment; filename=" & fileName)
Response.ContentType = "application/octet-stream"
Response.BinaryWrite(fileBytes)
HttpContext.Current.ApplicationInstance.CompleteRequest()
Catch ex As Exception
MsgBox(ex.Message)
End Try