Search the web
Sign In
New User? Sign Up
active-server-pages · Active Server Pages Developers' List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
RC4 Encryption   Message List  
Reply | Forward Message #12385 of 12411 |
(push-)Downloading from IE

Hey there

I have a script that should download 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..."

In fact I have a similar issue at the moment, when downloading a JPG - the
script first checks some database stuff, then retrieves the image from
higher-than-the-root and pushes it to the user. Works like a charm in
Firefox, but chokes in IE.

any idea what it could be?
ASP code attached.

Thanks!
Moshe

<%
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, 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)
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

%>




Tue May 5, 2009 7:00 pm

tapnack
Offline Offline
Send Email Send Email

Forward
Message #12385 of 12411 |
Expand Messages Author Sort by Date

Hey guys Anyone still around here? I have an issue that's really been messing with my head! I have a ready-made function for RC4 encryption. Then it converted...
Moshe Tapnack
tapnack
Offline Send Email
Apr 19, 2009
10:57 pm

Hi Moshe, ... Yep. :) ... Sounds like it's one of either two problems: * The characters in the first implementation are a different charset than in the second...
Shawn K. Hall
shawn_ra
Online Now Send Email
Apr 20, 2009
2:49 am

Hey Shawn Good to hear from you! And especially with as detailed a reply! Both interfaces are UTF8, but I will check what the database is. I assume that that...
Moshe Tapnack
tapnack
Offline Send Email
Apr 20, 2009
9:34 pm

Hey there I have a script that should download a CSV file from the browser. It works perfectly on Firefox and Chrome - but on IE(v7) it chokes and throws and ...
Moshe Tapnack
tapnack
Offline Send Email
May 5, 2009
7:00 pm

You're getting an IE error, but have shown a script that we are not going to be able to run. This is not going to allow analysis. What you need to provide is...
David Smart
smartware_co...
Offline Send Email
May 5, 2009
9:48 pm

Hi Dave There is no HTML - it's a purely ASP server side page - its responsing to the CSV file. And in FF the script works perfectly anyway... ... From:...
Moshe Tapnack
tapnack
Offline Send Email
May 5, 2009
10:54 pm

Hi Moshe, Change this: Response.ContentType = "text/csv" To this: Response.ContentType = "application/x-msdownload" This is the only way to consistently...
Shawn K. Hall
shawn_ra
Online Now Send Email
May 6, 2009
3:40 am

Hi Shawn A VERY belated thank you for this reply - I was away on reserve duty, vacation, and a little work time in-between the 2... and I have just tried this...
Moshe Tapnack
tapnack
Offline Send Email
Aug 9, 2009
3:03 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help