Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want play a sound file using C# it is successfully working in local system but not working in live? Here is my code.

System.Media.SoundPlayer player = new System.Media.SoundPlayer(Server.MapPath("../Sound/beep-5.wav"));
player.Play();

Please help me, what's the wrong with my code?
Posted

1 solution

I assume you mean it works fin in development, but doesn't when I publish it to a web site?
If so, then no, it won't work. C# code is executed on the server, not the client. So your "Beep" is sounding in the server room, miles away from the client. And probably annoying the heck out of the host admin.

It appeared to work in development, because the server and the client were the same computer.

Have a look here: Playing sound on client asp.net[^] - it's google, and you should find the info you want.
 
Share this answer
 
Comments
Arjun Menon U.K 2-Apr-13 7:03am    
HI Original Griff, what if i want to open a player and play the sound??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900