gpt4 book ai didi

asp.net - C# Asp Net 在 Chrome 12 中下载时出现问题

转载 作者:行者123 更新时间:2023-12-02 11:10:14 25 4
gpt4 key购买 nike

我的项目遇到问题。我有一些用于下载内容的代码:.doc、.zip 等

在 chrome 更新版本 12 之前一直工作正常,之后浏览器显示错误消息:“下载中断”。

我已经在其他浏览器(Chrome 11、FF 和 IE8)中进行了测试,一切正常。

代码示例是:

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword");
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + filename + ".doc");
HttpContext.Current.Response.AppendHeader("Content-Transfer-Encoding", "binary");
HttpContext.Current.Response.Write(strBody);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Close();

有人知道会发生什么或者我该如何解决这个问题?

诗。抱歉我的英语,我是巴西人:)

最佳答案

根据this forum中的回答添加 Response.End() 解决了问题。

就你而言,它是

HttpContext.Current.Response.Write(strBody);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
HttpContext.Current.Response.Close();

关于asp.net - C# Asp Net 在 Chrome 12 中下载时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6471706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com