Thursday, March 22, 2012

Serve SWF files from ASPX

Hello,

I would like to be able to allow people to link to videos on my site in the following manner (embed in their own websites):

<OBJECT CLASSID="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,22,0" ID="FVS" Width="720" Height="526">
<PARAM NAME="movie" VALUE="http://www.example.com/video.aspx?cid=123456">
<PARAM NAME="bgcolor" VALUE="#000000">
<EMBED NAME="FVS" src=http://www.example.com/video.aspx?cid=123456 BGCOLOR="#000000"
WIDTH="720" HEIGHT="526" TYPE="application/x-shockwave-flash" pluginspage=http://www.macromedia.com/go/getflashplayer">
</EMBED>
</OBJECT>

What I would like to do is have video.aspx choose avideo at random and serve to this particular customer ID ('videos' are all swf files). Forsimplicity's sake let's assume that I have 1000 SWF files all called1000.swf, 1001.swf etc. in the same directory as video.aspx. Is itpossible to code the page in a way that would allow me to do that? Ifso, how could I go about it, I have absolutely not idea. I can write the logic for selecting a random file, I just don't know how, once its selected, do I serve it to the end user. Any helpwould be appreciated.

M.

Hi,

You may take all files name of the directory in a arraylist. Then chose a filename from this arraylist using a random value.

and show it.


for some strange reason wherever I post this question (I did that on multiple forums) I always get the same response with suggestions how to choose a random file. I don't have a problem with that. I have a problem with the "and show it" part - I don't know how to make my object (see original code) to think that instead of aspx file I'm serving a SWF file.

I've been reading up about HttpHandlers and such, but there's got to be an easier way to do this without having to resort to configuring IIS and registering the handlers.

0 comments:

Post a Comment