View Full Version : Forcing IE to open "Save As" box

01-29-2007, 11:29 PM
I am attempting to get IE to show a CSV/XLS file as a download, or at the very least, to open Excel when opened... but while it works fine in FireFox, it simply displayes the info as plain text in IE

Here is the Basic Code I am using.

Note: "Echo" is an alias to Response.write.

' I have tried text/csv, application/x-msexcel, and a few others
Response.contentType = "application/ms-excel"

' I have tried both as an attachment as well as inline
call Response.addHeader("content-disposition","attachment;filename=users.xls")

Response.buffer = true
dim con : set con = server.createobject("ADODB.Connection")
call con.open("All the Usual")
dim aFields : aFields = Array("Name","Address","Phone")
dim rs : set rs = con.execute("SELECT * from UserTable")

' Please note that i have also build this into a textfile
' and then loaded it in with ADODB.STREAM using
' Response.BinaryWrite o.read

If Not Rs.Eof Then
echo "<table>" & vbcrlf
echo "<tr>"
for i = 0 to uBound(aFields)
echo "<td>" & aFields(i) & "</td>"
echo "</tr>" & vbcrlf
Do While Not Rs.Eof
echo "<tr>"
for i = 0 to uBound(aFields)
echo "<td nowrap=""nowrap"">" & rs(aFields(i)) & "</td>"
echo "</tr>" & vbcrlf
echo "</tr></table>"
End IF


Absolutally nothing i have tried as gotten any differance in IE:
- WinXP Pro
- IE 6.0.2

Can Anyone Help?
Thanks in Advance

01-30-2007, 02:53 PM
Have you tried application/vnd.ms-excel