Getting FileNotFound Exception in bold line
string filePath = string.Empty;
using (ZipFile zip = new ZipFile())
{
zip.AlternateEncodingUsage = ZipOption.AsNecessary;
zip.AddDirectoryByName("Files");
foreach (GridViewRow row in GridFileDetails.Rows)
{
filePath = (row.FindControl("lblFilePath") as Label).Text;
if (filePath.ToString() != "/")
{
zip.AddFile(filePath, "Files");
}
}
Response.Clear();
Response.BufferOutput = false;
string zipName = String.Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"));
Response.ContentType = "application/zip";
try
{
Response.AddHeader("content-disposition", "attachment; filename=" + zipName);
zip.Save(Response.OutputStream); // Error here
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('" + ex.Message + "');", true);
}
Response.End();
}
please Help me
thanks in advance