visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Web :: Browser issues :: onclick "save target as" excel


By: Bernard France  Date: 09/09/2005 08:43:35  English  Points: 20 Status: Answered
Quality : Excellent
Hi,

I generate a report in a comma delimited file and give it
a name like MyReport.csv . I then set an hyperlink to point to the file.

HyperLink1.text = "Download"
Hyperlink1.NavigateUrl = "MyReport.csv"

When the user clicks the hyperLink I would always like to
see the dialog come up that asks if you want to 'Open' the
file or 'Save' the file to disk.

I get mixed results. If the client has Excel installed
then this dialog does not come up and IE pops the file
into a spread sheet. If Excel is not installed then IE
pops the file up in a text window (same thing happens if I
delete the csv from the folder options).

If I change the file extension to something strange
like .xyz123 then it always comes up with the dialog but
I want the user to have the option to save the file as
csv.

Anyway, is there some way to force this to always come up
with the Open or Save dialog?

Tks,
By: VGR Date: 09/09/2005 08:51:00 English  Type : Answer
Hello. This is answered in the PAQ but again the solution is relatively simple :

use either Response.ContentType="application/octet-stream" or Response.ContentType ="application/save" or (if the webserver has a directive

AddHandler send-as-is asis

) Response.ContentType ="asis"


Best regards

Do register to be able to answer

EContact
browser fav
page generated in 326.630830 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page