CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Saturday, September 02, 2006

Convert a byte array into a download stream in ASP.NET

//Set the byte array using some custom 'file getter' class of your ownbyte [] f = myFileGetter.GetFileBytes("foo")//The rest is history!Response.Clear();Response.ContentType = "application/octet-stream";Response.AddHeader("Content-Disposition", "attachment; filename=foo");Response.Flush();Response.OutputStream.Write(f, 0, f.Length);

Post a Comment