Я пытаюсь загрузить zip-файл и одновременно извлекать и запускать разархивированный контент, однако при выполнении кода zip-файл извлекается в расположении сервера, а также там выполняется контент. Ниже приведен код, который я написал. Я разместил код в локальной сети. Я даже пробовал Write () вместо TransmitFile ()
try
{
string launchPresentationPath = Convert.ToString(e.CommandArgument);
string exeFolder = launchPresentationPath.Replace("/Launch_Presentation.exe", "");
string path = HttpContext.Current.Request.PhysicalApplicationPath + "/Uploads/" + exeFolder + ".zip"; //+ Convert.ToString(e.CommandArgument);
string userRoot = System.Environment.GetEnvironmentVariable("USERPROFILE");
string str1 = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
downloadFolder = Path.Combine(userRoot, "Downloads");
string strAttach = "attachment; filename=" + exeFolder.Substring(exeFolder.IndexOf('/') + 1) + ".zip";
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
HttpResponse res = HttpContext.Current.Response;
res.Clear();
res.AppendHeader("content-disposition", strAttach);
res.ContentType = "application/octet-stream";
res.TransmitFile(path);
using (ZipFile zip2 = ZipFile.Read(path))
{
zip2.ExtractAll(downloadFolder, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite);
}
DirectoryInfo f = new DirectoryInfo(downloadFolder + "\\" + exeFolder.Substring(exeFolder.IndexOf('/') + 1));
FileInfo[] a = f.GetFiles();
if (a.Length > 0)
{
ProcessStartInfo myProcess = new ProcessStartInfo(downloadFolder + "\\" + exeFolder.Substring(exeFolder.IndexOf('/') + 1) + "\\Launch_Presentation.exe");
myProcess.UseShellExecute = false;
Process process = Process.Start(myProcess);
int Exeid = process.Id;
this.Visible = false;
this.Visible = true;
process.EnableRaisingEvents = true;
pdfFrame.Visible = videoFrame.Visible = false;
Response.Redirect(Convert.ToString(this.Page.Request.Url.AbsoluteUri));
process.Exited += (myProcess_HasExited);
}
res.Flush();
res.End();
}
}
catch (Exception ex)
{
}
почему он не загружается в клиенте?