This paper illustrates two methods of asp.net to realize the output of binary stream. Share to everyone for your reference, specific as follows:
Method One:
System.IO.MemoryStream ms = new System.IO.MemoryStream ();
System.IO.Stream str = new FileUpload (). Postedfile.inputstream;
System.Drawing.Bitmap map = new System.Drawing.Bitmap (str);
Map. Save (MS, System.Drawing.Imaging.ImageFormat.Gif);
Response.clearcontent ();
Response.ContentType = "Image/gif";
Response.BinaryWrite (Ms. ToArray ());
Method Two:
System.IO.FileStream fs = new System.IO.FileStream ("Filename", System.IO.FileMode.Open, System.IO.FileAccess.Read);
byte[] datas = new Byte[fs. Length];
Fs. Read (datas, 0, Convert.ToInt32 (FS). Length));
Fs. Close ();
Response.OutputStream.Write (fs. Datas,0,convert.toint32. Length));
Response.End ();
I hope this article will help you to ASP.net program design.