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
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vijay YadavPosted May 7, 2011, 3:12 AM
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();