How do you ensure a mimetype in asp.net?
Posted
by Sem Dendoncker
on Stack Overflow
See other posts from Stack Overflow
or by Sem Dendoncker
Published on 2010-04-20T08:00:28Z
Indexed on
2010/04/20
8:03 UTC
Read the original article
Hit count: 157
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.
© Stack Overflow or respective owner