How do you ensure a mimetype in asp.net?
- by Sem Dendoncker
Hello,
I have the following code to export a zip file:
byte[] buffer = FileUtil.FileToByteArray(zipLocation, true);
// push the memory data to the client.
_ctx.Response.ContentType = "application/zip";
_ctx.Response.AddHeader("content-disposition", String.Format("attachment; filename={0}", String.Format("map{0}.zip", mapId)));
_ctx.Response.BinaryWrite(buffer);
This code works great. After every export I get a perfectly made zipfile. The problem however is that when I try to import it, the mimetype sometimes is "application/empty".
Now I wonder how can I ensure that the mimetype is always added?
Cheers,
M.