API
Version 7.x > API > Write byte[] data View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/14/2013 3:39:27 PM
   
Write byte[] data
I've got a web service that returns data in byte[] format and I want to display it or allow the user to download the file. Is there a page that I can inherit to allow this to happen simply by me passing the byte[] object to it? I've attempted to simply perform a response.binarywrite(byte[] object) with little success. I continue to receive an I/O error when the PDF opens.

I have my page located here: /CMSPages/SubFolder/GetReport.aspx

Code is simple:
Response.Clear();
Response.ContentType = "application/pdf";
Response.BinaryWrite(byteData);
Response.AddHeader("Content-Disposition", "inline; filename=statement.pdf");

User avatar
Certified Developer 12
Certified Developer 12
Accepted solutionAccepted solution
kentico-jx2tech - 5/14/2013 3:51:18 PM
   
RE:Write byte[] data
try adding...
Response.End();

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/14/2013 4:08:47 PM
   
RE:Write byte[] data
I knew it was something simple. Guess I need to step away and take a break...