我遇到了 Response.ContentType 与进度条冲突的问题。基本上,我试图在将记录集保存到 CSV 文件时显示一个弹出进度条。
我在任何地方都使用下面的这两行来调用进度条并在页面底部将其关闭,因此它适用于没有 (Response.AddHeader "Content-Disposition", "attachment;filename=export.csv") 的常规页面
response.write("<script language=""javascript"">ProgressStart();</script>")
Response.Write("<script>ProgressDestroy()</script>")
我在下面收到此错误,我知道它与 Response.ContactType“text/csv”冲突。
Response object error 'ASP 0156 : 80004005'
Header Error
/Apps/ERP/Company/ExportCompanyView.asp, line 253
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
有没有办法绕过或欺骗它,所以我不会与“Response.ContentType =“text/csv””冲突?
提前致谢,
这段代码是所有过程发生的地方:
If SOViewSQL <> "" Then
set rs1 = conn.execute(SOViewSQL)
response.write("<script language=""javascript"">ProgressStart();</script>")
response.flush()
Write_CSV_From_Recordset RS1
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "attachment;filename=export.csv"
Response.Write("<script>ProgressDestroy()</script>")
'response.flush()
set rs1 = nothing
conn.close
set conn = nothing
End If