Click here to Skip to main content
16,002,104 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used this practice but I have a problem.
my file is very small 22 byte but it must be 56KB.
can anyone help me? I use code below:

I want save a table as xml and zip it and download it .I don't want save file on server and then download it

C#
MemoryStream xmlfileStream = new MemoryStream();
xmlfileStream.Seek(0, SeekOrigin.Begin);

dsk.WriteXml(xmlfileStream);//dsk <--- this id a dataset
MemoryStream ms = new MemoryStream();
ms.Seek(0, SeekOrigin.Begin);
using (Ionic.Zip.ZipFile zipFile = new Ionic.Zip.ZipFile())
     {
           zipFile.AddEntry(ketab.Nam+".xml", xmlfileStream);
           xmlfileStream.Flush();
           zipFile.Save(ms);
     }
Posted
Updated 14-Aug-14 9:05am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900