DotNetZip 및 ASP.NET과 관련된 이상한 상황을 디버깅 중입니다. 짧게 말하자면, 코드에 의해 생성되는 결과 zip 파일은 Firefox에 의해 안정적으로 다운로드되지만 다른 대부분의 브라우저는 간헐적으로 네트워크 오류를 반환합니다. 코드를 살펴본 결과 일반적으로 DotNetZip과 관련된 내용으로 읽 힙니다.때때로 ASP.NET을 사용하여 DotNetZip으로 만든 Zip 파일이 네트워크 오류를 일으킬 수 있습니다.
실마리가 있습니까?
감사합니다.
편집 : 완전한 방법이 있습니다. 내가 언급 한 바와 같이이수록, 그것에 대해 같은 일반의 :
protected void btnDownloadFolders_Click(object sender, EventArgs e)
{
//Current File path
var diRoot = new DirectoryInfo(_currentDirectoryPath);
var allFiles = Directory.GetFiles(diRoot.FullName, "*.*", SearchOption.AllDirectories);
Response.Clear();
Response.BufferOutput = false;
var archiveName = String.Format("{0}-{1}.zip", diRoot.Name, DateTime.Now.ToString("yyyy-MM-dd HHmmss"));
Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "inline; filename=\"" + archiveName + "\"");
using (var zip = new ZipFile())
{
foreach (var strFile in allFiles)
{
var strFileName = Path.GetFileName(strFile);
zip.AddFile(strFile,
strFile.Replace("\\" + strFileName, string.Empty).Replace(diRoot.FullName, string.Empty));
}
zip.Save(Response.OutputStream);
}
Response.Close();
}
당신은이보다 더 많은 정보를 제공 할 필요가 – Sunshine
최소한의, 완전한, 검증 가능한 예를 들어, http://stackoverflow.com/help/mcve을 제공하십시오. 우리는 귀하의 화면을 보거나 네트워크 트래픽을 검사 할 수 없습니다. 나는 당신이 코드 문제에 관해 여기 있다고 가정한다. 코드를 볼 수 없다면 어떻게해야합니까? – Amy
이 문제를 해결하려면'Response.Close();'를'Response.Flush();로 변경하십시오. https://stackoverflow.com/a/736462/481207을 참조하십시오. (Chrome 버전 61. – Matt