Hey there
I have a script that should wonload a CSV file from the browser. It works perfectly on Firefox and Chrome - but on IE(v7) it chokes and throws and error - "IE was not able to download the file..."
any idea what it could be?
ASP code attached.
thanks!
I have a script that should wonload a CSV file from the browser. It works perfectly on Firefox and Chrome - but on IE(v7) it chokes and throws and error - "IE was not able to download the file..."
any idea what it could be?
ASP code attached.
thanks!
Code:
<%
sql = "SELECT ...."
set rs = conn.execute(sql)
if rs.eof then
response.Write("No data available in this table")
set rs = nothing
else
strReturn = ""
for each field in rs.fields
strReturn = strReturn & field.name & ","
next
strReturn = left(strReturn, len(strReturn)-1) 'remove last comma
strReturn = strReturn & vbcr
do while not rs.eof
for each field in rs.fields
fieldvalue = rs.fields(field.name) & ""
fieldvalue = replace(fieldvalue, ","," ")
fieldvalue = replace(fieldvalue, "","'")
fieldvalue = replace(fieldvalue, """","'")
fieldvalue = replace(fieldvalue, "","'")
fieldvalue = replace(fieldvalue, "="," ")
fieldvalue = replace(fieldvalue, vbCrLf," ")
fieldvalue = replace(fieldvalue, vbCr," ")
fieldvalue = replace(fieldvalue, chr(10)," ")
fieldvalue = replace(fieldvalue, chr(13)," ")
strReturn = strReturn & chr(34) & fieldvalue & chr(34) & ","
next
strReturn = left(strReturn, len(strReturn)-1) 'remove last comma
strReturn = strReturn & vbCrLf
rs.movenext
loop
rs.Close
set rs = Nothing
server.ScriptTimeout = 18000
Response.AddHeader "Content-Disposition", "attachment; filename=report-" & request.Cookies(ewProjectName)("programID") & "-" & exportTable&".csv"
Response.Charset = "UTF-8"
Response.ContentType = "text/csv"
Response.Write strReturn
Response.Flush
Response.Clear
%>