1

I have made the simplest test in order to check if SoundPlayer will play a wave file. From the local machine works just fine, once the site is on IIS it doesn't play the sounds (or give any error).

Here is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Media;

public partial class Default2 : System.Web.UI.Page
{   public SoundPlayer spWave;
    protected void Page_Load(object sender, EventArgs e)
    {

        spWave = new SoundPlayer("\\\\server\\site\\wavetest.wav");
        spWave.Play();
    }
}

Is there anything else I need to add to the .aspx file to get this to work?

Or is there an easier way of playing very short wave files, without displaying any media controls on the page?

sd_dracula
  • 3,796
  • 28
  • 87
  • 158

1 Answers1

1

SoundPlayer is not an aspx control, you should find a web control which can play your wav file and put that on your aspx page. Now you play the wav on your web server in iis every time your page loads.

You can start here looking for playing wav files on a webpage: google: wav aspx

Peter
  • 27,590
  • 8
  • 64
  • 84
  • the likes of this example which is JS: http://www.aspsnippets.com/Articles/Play-WAV-sound-files-in-ASP.Net-using-JavaScript.aspx work fine if assigned to a button. But what if I want to play that file based on an event such, as GridRow Row Updated event? – sd_dracula Mar 25 '13 at 12:30