Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
Response.Clear();
Response.ContentType = "application/zip";
 
Response.AddHeader("content-disposition", "filename=" + "Test.xlsx");
 
string path = @"C:\ReportsDocs";
 
using (ZipFile zip = new ZipFile())
{                          
 
   zip.AddFile(path + @"\docProps\core.xml", "docProp");
   zip.AddFile(path + @"\docProps\app.xml", "docProp");
   zip.AddFile(path + @"\docProps\thumbnail.wmf", "docProp"); 
                          
   zip.Save(Response.OutputStream);
 

}

The above code is working fine in asp.net but not in sharepoint.
Ionic.Zip dll is used for creating zip file. It could not read the data from files.
Please help me.
Posted
Updated 3-Feb-12 21:38pm
v3
Comments
Sergey Alexandrovich Kryukov 4-Feb-12 3:39am    
"Not working" is not informative. Could you use "Improve question" above?
--SA

1 solution

I would assume the problem is the location of the file, "C:/". In fact, there are no situations where hard-coded path name could be useful. Anywhere, not just in Silverlight. You always should calculate all paths. And locations like "C:/" are actually illegal for application data, especially in Windows 7.

With HTTP servers, you can have access only withing the root path of the Web site.

—SA
 
Share this answer
 

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