可能重复:
如何在 asp.net 网页中播放声音?
嗨,我正在尝试通过单击按钮播放声音。但它不会播放此声音。它会播放另一种声音。我不想使用绝对地址我需要使用相对地址。这是我的代码
protected void Button1_Click1(object sender, EventArgs e)
{
System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream s = a.GetManifestResourceStream("chimes.wav");
SoundPlayer player = new SoundPlayer(s);
player.Play();
}
在这段代码中,s 的值始终为 NULL,我不知道为什么。