Server storing dynamically generated media files

A

andchoi

I am wondering whether this is the best way to do this. Would love to
hear what people think.
Here is the scenario:

I have this ASP.NET 2.0 page which allows user to enter some parameters
and then it dynamically generates a WAV or WMV file, depending on
preference. I want to send this back to the user via an <OBJECT> tag.

The way I am doing this right now is to assign the byte[] array to the
Session. Then, I generate an <OBJECT> tag (via an ASP literal control
added to a PlaceHolder control on the page) with the name being another
ASP Page (let's say MediaPlay.aspx).

In the Page load method of MediaPlay.aspx, I do something like this
(skip the error checking for clarity):

byte[] buffer = Session["MediaFile"];
Response.ContentType = Session["MediaContentType"];
Response.BinaryWrite(buffer);
Response.Flush();
Response.Close();

It seems to work, but I am wondering whether there is a better way to
do this. What do you think?
 
B

Bruce Barker

probably not the best.

1) if you use inproc sessions, a large number of users may cause a recycle.
2) even if you use out of proc sessions, the wave file must be loaded on
every page hit after one is loaded.
3) if you clear the wave file from memory after download, a page referesh
will fail

you should store then in a temp storage (sql or disk), and run a cleanup job
that purges after session close.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top