Download CSV file, browser appends brackets

B

ben.s.carlson

Hi,

I'm sending a file to the browser using asp.net, and I want it to open
up in excel. The dialog box pops up, but when I press the open button,
the file opens up with a [1] appended to it. That is, if my file is
called File.csv, the browser opens it up as File[1].csv. I would chalk
this up as browser behavior, but there are actually examples out there
where the [1] is not appended, notably
http://www.sharkcode.com/ssc/Resume/DownloadResume.aspx. Does anybody
know how this is accomplished?

Here is the code that I'm currently using (VB.Net):

Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=""" &
sFileName & """")
Response.Flush()
Response.Write("C:\Windows\Temp\Test Download.csv")
Response.End()

Thanks for any help,

Ben
 
B

ben.s.carlson

I should mention that I'm using Internet Explorer. The URL above
actually does not exhibit the functionality I want when using Internet
Explorer (I was using firefox before, which does not append the [1]).
So I'm back to thinking that it's a browser issue, unless anybody else
has any insight.

Ben
 
D

Dan Manges

I should mention that I'm using Internet Explorer. The URL above
actually does not exhibit the functionality I want when using Internet
Explorer (I was using firefox before, which does not append the [1]).
So I'm back to thinking that it's a browser issue, unless anybody else
has any insight.

Ben,

I would definitely just write it off as a browser issue. For the
browser to open the file directly without saving it, it has to store the
file in your temp files. If you have already downloaded the file once
and filename.csv in already in there, it will create filename[1].csv.

If people save the file instead of directly opening it I don't think it
will be a problem.

Dan Manges
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top