tags:

views:

52

answers:

2

I have file in the form of binary array and i need the browser to open a download dialogue and save the file.

i tried

Response.BinaryWrite(fileData);

but it just added the binary character to the page and didn't open a download dialogue!

A: 

You need also to set the content type:

Response.ContentType = "application/octet-stream";
Darin Dimitrov
+3  A: 

Try this:

Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=fileToDownload");
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(fileData);
Response.Flush();
Response.End();
David Hedlund