ZipFileToCreate = "c:\user\desktop\webservice\file.zip";
So, when i try to save this file it creates the folder for the path like user\desktop\webservice\file\
Why is it so?
FileStream fs = new FileStream(ZipFileToCreate, FileMode.Open);
byte[] data = new Byte[fs.Length];
BinaryReader br = new BinaryReader(fs);
br.Read(data, 0, data.Length);
br.Close();
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AppendHeader("Content-Disposition", "filename=" + Parameter + ".zip");
DeleteOldFiles();
Response.BinaryWrite(data);
I think you need to be using the
Environment.GetFolderPathmethod to find the current users’ Desktop folder rather than hard-coding “c:\user\desktop\webservice\file.zip”. Also usingPath.Combineto build a path is more reliable than string concatenation. Try