tags:

views:

23

answers:

1

Hi,

I have made a WCF web service that streams a 200 mb zip file. Can some one please advise me on how i can read this stream at my client and then give option to the user to download that

Thanks

+1  A: 

If your client is an asp.net site, why not just a simple ashx handler? Set the mime type application/x-zip, and set the ResponseStream of the handler to the zip file stream.

Justin Dearing
thanks for the reply, Well i have a simple ashx handler that calls my WCF service. but i am stuglling to read the stream. Can you please provide me some code
Amit
Actually, you want a binary reader so you can read byte arrays.
Justin Dearing
but if i read it into a byte array then it i don't think i can get the complete benifit of streaming. Please advise
Amit
You read it in chunks, inside a while loop. Are you offerinf for download through an ashx handler or other method?
Justin Dearing
i am doing it in a ashx handler
Amit
I don't think there is a more effecient way than reading chunks of the file in a while loop. and doing context.Response.Write(). Check out the HttpRespons class though. http://msdn.microsoft.com/en-us/library/dhy78ycf.aspx
Justin Dearing