Vista problem with playing .wav files from C#

R

rnmalhotra

Experts,

I have a simple .aspx page that takes a path to a .wav file, and
plays it. This page works fine on all OSs (Windows 2000, Windows 2003,
Windows XP), but not on Vista. Could the protected mode on vista be
interfering with this page? Any other ideas on why the code does not
work on Vista would be greatly appreciated. The (simple) code for this
page is

==========.aspx page========================================
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WavFileTest.aspx.cs" Inherits="MiscTests.WavFileTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter File Location: <asp:TextBox ID="WavFileName"
runat="server" />
<asp:Button ID="Play" Text="Play" runat="server"
OnClick="Play_Clicked" />
</div>
</form>
</body>
</html>


======================= .cs code behind
code======================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Media;

namespace MiscTests
{
public partial class WavFileTest : System.Web.UI.Page
{
protected TextBox WavFileName;
protected Button Play;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Play_Clicked(object sender, System.EventArgs e)
{
try
{

SoundPlayer player = new SoundPlayer();
player.SoundLocation = WavFileName.Text;
player.Load();
player.Play();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
}
}
============================================================================

Thank you in advance.

Best,

Raj.
 
G

George Ter-Saakov

You doing it wrong.
You playing it on the server. Why do you want to do that. It works for you
only because you are sitting in the same room where server is :)


George.
 
R

Raj

George,

Thanks for the note. That is the intent, becuase the client and
the server are always on the same machine. Any ideas on why it doesn't
work on Vista?

Best,
Raj.
 
G

George Ter-Saakov

My educated guess would be that IIS does not have access to talk to
speakers. Most likely it needs some elevated permissions to use the
hardware.

George.


George,

Thanks for the note. That is the intent, becuase the client and
the server are always on the same machine. Any ideas on why it doesn't
work on Vista?

Best,
Raj.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top