We help IT Professionals succeed at work.

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

Randy Rich
Randy Rich asked
on
2,945 Views
Last Modified: 2010-05-18
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

Comment
Watch Question

Mahmood DehghanSenior Software Engineer
CERTIFIED EXPERT

Commented:
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/Programming/Languages/Scripting/JavaScript/Q_23198126.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
Randy RichPresident

Author

Commented:
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.
Mahmood DehghanSenior Software Engineer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
President
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.