Hi,
I'd use a Session variable and output the client-side code programmatically.
The code below checks for the Session variable "Played". If the value is not
1, output the code to play the sound. Then set the Session variable to 1. As
long as the session is alive (that is, until the user leaves the site for 20
minutes [default] or closes the browser), the sound won't play again.
Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If Not (Session("Played") = 1) Then
Page.ClientScript.RegisterStartupScript _
(Me.GetType, "sound", "<embed autostart='true' height='0' " & _
"loop='false' src='
http://www.devx.com/assets/devx/8990.mid' " &
_
" width='0'></embed>", False)
Session("Played") = 1
End If
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Play a sound once</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>