I’m trying to return a zipped file
public FileResult Download()
{
MemoryStream outputStream = new MemoryStream();
using (ZipFile zip = new ZipFile())
{
zip.AddEntry("asdasd.html", "<html>fgdfg</html>");
zip.AddEntry("asdassssd.html", "<html>asddsaf</html>");
zip.Save(outputStream);
}
return File(outputStream, "application/zip", "file.zip");
}
but in response it returns an error (in XML):
XML Parsing Error: no element found Location:
moz-nullprincipal:{122aa411-1418-43f5-b950-4347af7c7217} Line Number
1, Column 1:
What is wrong with my response (to zip files i use DotNetZip)?
You probably need to reset the MemoryStream to the beginning of its buffer before you return it to the client as a File.
I also suggest you use a proxy like Fiddler to inspect the Http response to get a better handle on what exactly your request is sending.