I am having problem with Response.ContentType Conflicts with Progress Bar. Basically, I am trying to display a pop up progress bar while saving the recordset to a CSV file.
I use this two lines below everywhere to call the progress bar and close it at the bottom of a page, so it works with regular page without (Response.AddHeader "Content-Disposition", "attachment;filename=export.csv")
response.write("<script language=""javascript"">ProgressStart();</script>")
Response.Write("<script>ProgressDestroy()</script>")
I am getting this error below, and I know it is conflicting with the 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.
Is there a way to by pass or trick it, so I won't conflict with "Response.ContentType = "text/csv""?
Thanks in advance,
This code is where all the process happens:
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