Http Streaming in asp.net

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Hello

Suppose I set up an http handler to stream data from a very large file to a
web client.
Would it be possible to communicate with the handler whilst it's returning
data in order to reposition the file position?
I guess this is a little bit like video or audio controls in an http
streaming control..

So if I had something like

int count = imgStream.Read(buffer, 0, buffersize);
while (count > 0)
{
/* Reposition output-stream based on user request here */
context.Response.OutputStream.Write(buffer, 0, count);
count = imgStream.Read(buffer, 0, buffersize);
}

inside the ProcessRequest method of my http handler, then would it be
possible to reposition the output stream inside the while loop. Maybe I
could do this by means of a shared session variable which could be updated
by a separate handler or something? Or is there a better approach within
asp.net?

I know there are probably existing technolgies that can solve this problem
for me but I'd like to understand how to do this sort of thing at a low
level within in asp.net.

Thanks in advance for any help.

Jeff
 
not with asp.net, it not low level enough to change the http protocol
used by iis. in general iis/asp.net buffer the input request, and passes
it to asp.net after its read (note that Request.InputStream is buffered,
while the output may or may not be). you can probably do this with an
isapi filter in ii 6.0, or with iis 7.0 doing a module.

your other alternative is to use two contentions from the client, a
controller and a stream.

note: asp.net is not designed for streaming, so if you will have to bump
up connection limits and pool sizes to support very many.


-- bruce (sqlwork.com)
 
Back
Top