Link to home
Start Free TrialLog in
Avatar of Randy Rich
Randy RichFlag for United States of America

asked on

How can I play an mp3 file from an asp.net app without using a hyperlink?

I want my users to select an mp3 from a gridview and then play it in the browser.  When I try using the server.transfer function the browser opens the mp3 up like a document instead of playing it.  
Protected Sub GridViewSavedMessages_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridViewSavedMessages.SelectedIndexChanged
        Dim StartingDirectory As String = "\ChurchLink360\Messages\" & Session.Item("ACCOUNT") & "\" & Session.Item("AUTHOR") & "\"
        Dim FullUploadPath As String = System.IO.Path.Combine(StartingDirectory, "A Place of Prayer.mp3")
        Server.Transfer(FullUploadPath)
    End Sub

Open in new window

Avatar of Mahmood Dehghan
Mahmood Dehghan
Flag of Iran, Islamic Republic of image

You have several option:
- use an Adobe flash object inside your page
- use Silverlight. I prefer this one. Silverlight is great.

also take a look at:
https://www.experts-exchange.com/questions/23198126/Pull-random-MP3-from-folder-to-play-onLoad.html 
and: http://www.trap17.com/index.php/play-mp3-music-online_t40809.html
and this is nice: http://www.wimpyplayer.com/products/wimpy_mp3.html
Avatar of Randy Rich

ASKER

I'm not wanting anything complex.  I've got a gridview that lists several audio files.  I want my user to click on one of those and play the file.  If I drop a hyperlink control on the form it works great.  Are you saying that the only way to run a media file from an asp.net page is to install a player?  If so, can you explain why that is.  Bare with me.  I'm new to asp.net and just trying to learn.
SOLUTION
Avatar of Mahmood Dehghan
Mahmood Dehghan
Flag of Iran, Islamic Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial