Vista problem with playing .wav files from C#

  • Thread starter Thread starter rnmalhotra
  • Start date Start date
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.
 
This is 100% the wrong group to post to. You really need to post to one of
the dotnet or C# groups. I'll bet 99.8% of the people here wouldn't
understand the code
 
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.

You might want to try this on the MSDN Forums:
http://forums.microsoft.com/msdn/default.aspx?siteid=1
 
You can turn off Protected Mode under Internet Options.
(It will nag you until you turn it back on, but this should let you test
your theory.)
 
You can turn off protected mode under Internet options to test your theory.
(IE will nag you until you turn it back on.)
 
Back
Top