Copy folder in server to local system
hi can an one help me how to copy the folder in solution explorer to local system as a Zip folder when i click on download button in asp.net
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Vijay YadavRank #1,637 · 943 reputationPosted May 6, 2011, 11:12 PM EDT
You can refer the below code:
string strFilePath = "~/Docs/Your file name with extension";
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(strFilePath));
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.WriteFile(strFilePath);
HttpContext.Current.Response.End();