Hi,
I have a callback that is being called in which I need to create a csv file
that the user can download.
I have the string created correctly but the download prompt dialog box is
not appearing
Here is the last piece of code that should do the download
strFileName = Session("SourceLayer").ToString().Replace(" ",
"_") + DateTime.Now.Year.ToString() + month + day + ".csv"
Response.AddHeader("Content-disposition", "attachment;
filename=" + strFileName)
Response.ContentType = "text/plain"
Response.Write(csvText)
Response.Flush()
Response.End()
Any help would be appreciated
Cor Ligthert[MVP] - 05 Mar 2008 04:50 GMT
Hi,
It is again a while ago that I did this, bus as far as I remember me you
need if you want to download something to set your file on the server and
give the user the link to that using that text control with the option
"File" or just use the a linklabel.
Cor
> Hi,
>
[quoted text clipped - 19 lines]
>
> Any help would be appreciated
(O)enone - 05 Mar 2008 09:33 GMT
> Here is the last piece of code that should do the download
[...]
I just looked at some of my own code that does what you're trying to do, and
the only differences I can spot are:
- my code also provides a name in the ContentType:
Response.ContentType = "text/plain; name=""filename.txt"""
(actually my code isn't using text/plain as its mime type but I don't see
why that should result in different behaviour).
- my code performs a Response.BinaryWrite instead of Response.Write, as it's
sending binary data instead of text. Again I don't see why that would cause
different behaviour, though.
So try adding the name to the ContentType and see if that makes any
difference..?

Signature
(O)enone