IE, embedded WMP 9.0: double GET request

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RomanVN

    IE, embedded WMP 9.0: double GET request

    Hello,

    I have the following problem.
    The Windows MediaPlayer object is embedded in an ASP page:

    --- test.asp ---------------------------
    <%@ LANGUAGE=VBScri pt enablesessionst ate=true LCID=1033 %>
    <% option explicit %>
    <html>
    <body>

    <h2>TEST</h2>
    <embed type="applicati on/x-mplayer2"
    pluginspage="ht tp://www.microsoft.c om/Windows/MediaPlayer/"
    src="test2.asp? fn=test.wav"
    width=320
    height=69
    name="MediaPlay er"
    autostart="Fals e"
    ShowStatusBar=1
    ShowDisplay=0
    ShowControls=1>
    </embed>
    </body>
    </html>
    -------------------------------

    The src parameter of the MediaPlayer object references to another ASP
    script
    which returns WAV file as a binary stream:

    --- test2.asp ----------------------------
    <%@ LANGUAGE=VBScri pt enablesessionst ate=true LCID=1033 %>
    <% option explicit %>
    <%
    Dim fn
    fn = Request.QuerySt ring("fn")
    if not isNull(fn) and fn <"" then
    Dim vpath, path, strExt, strContentType
    vpath = "logs"
    path = Server.MapPath( vpath)

    strExt = LCase(GetFileEx tension(fn))
    if strExt = "mp3" then
    strContentType = "audio/mp3"
    else
    strContentType = "audio/wav"
    end if

    Dim strFilePath
    strFilePath = path & "\" & fn 'This is the path to the file on disk.

    Dim objStream
    Set objStream = Server.CreateOb ject("ADODB.Str eam")
    objStream.Open
    objStream.Type = 1
    objStream.LoadF romFile strFilePath

    Response.AddHea der "Content-Type", strContentType
    Response.AddHea der "Content-Disposition", "inline; filename=" & fn
    Response.AddHea der "Accept-Ranges", "bytes"
    Response.AddHea der "Content-Length", CStr(objStream. Size)
    Response.Binary Write objStream.Read

    objStream.Close
    Set objStream = Nothing
    end if

    Function GetFileExtensio n(fn)
    Dim strExt, intExtPos
    strExt = ""
    intExtPos = InstrRev(fn, ".")
    if (not IsNull(intExtPo s)) and intExtPos 0 then
    strExt = Mid(fn, intExtPos + 1)
    end if
    GetFileExtensio n = strExt
    End Function
    %>
    -------------------------------


    For some strange reason the web site receives 2 get requests:
    one from the MediaPlayer object and the other from the browser itself:


    2006-07-03 08:44:32 192.168.X.X - 192.168.X.X 80 GET /test.asp - 200 0
    1018
    Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.1;+SV 1;+.NET+CLR+1.1 .4322)
    2006-07-03 08:44:32 192.168.X.X - 192.168.X.X 80 GET /test2.asp
    fn=test.wav 200 0 119682 Windows-Media-Player/9.00.00.3250
    2006-07-03 08:44:32 192.168.X.X - 192.168.X.X 80 GET /test2.asp
    fn=test.wav 200 0 119682
    Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.1;+SV 1;+.NET+CLR+1.1 .4322)


    However, if the src parameter references a direct link to
    a static WAV file on the server (src="test.wav" ), then the browser
    sends one GET request (form the MediaPlayer):

    2006-07-03 08:45:05 192.168.X.X - 192.168.X.X 80 GET /test.asp - 200 0
    1005
    Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.1;+SV 1;+.NET+CLR+1.1 .4322)
    2006-07-03 08:45:05 192.168.X.X - 192.168.X.X 80 GET /test.wav - 200 0
    119635 Windows-Media-Player/9.00.00.3250


    How can I eliminate the extra request?

Working...