An "ad" insertion with event tags in an .asx file does not work as expected when it points to an ASP page that generates pages dynamically. Although the ASP page generates a different .asx file every time, Windows Media Player always uses the first one.
The following sample files demonstrate this behavior.
Sample .asx file:
<ASX version = "3.0">
<title>Live Stream</title>
<entry>
<ref href = "mms://server1/station1"/>
</entry>
<EVENT NAME="ad" WHENDONE="RESUME">
<ENTRYREF HREF="http://server1/dynasx.asp"/>
</EVENT>
</ASX>
Sample ASP page:
<% @LANGUAGE="VBSCRIPT" %>
<%
Response.ContentType = "video/x-ms-asf"
Response.Write "<asx version = ""3.0"">" & vbCrLf
Dim MovNum
Dim MovieURL
MovNum = Application("MovieNumber")
MovNum = CInt(MovNum) +1
If MovNum = 4 Then MovNum = 1
Application("MovieNumber") = MovNum
Response.Write "<title>" & "Ad Number" & CStr(MovNum) & "</title>" & vbCrLf
Response.Write "<entry>" & vbCrLf
%>
<Ref href="mms://band-name/ad<%= MovNum %>.asf" />
<%
Response.Write "</entry>" & vbCrLf
Response.Write "</asx>" & vbCrLf
%>
To work around this behavior, let the ASP page generate one URL instead of one .asx file.
The following sample ASP page works with Windows Media Player:
<%
'Replace the following static URLs with database queries
'or Ad Server queries to generate a dynamic URL
Randomize
Index=Int(5*Rnd+1)
select Case Index
case 1
Response.Write "mms://server1/upgrade.ASF"
case 2
Response.Write "mms://server1/sample.ASF"
case 3
Response.Write "mms://server1/welcome1.ASF"
case 4
Response.Write "mms://server1/welcome2.ASF"
case 5
Response.Write "mms://server1/welcome3.ASF"
end select
%>
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.