Vamsi
Vamsi

Reputation: 4253

Firefox response.redirect not working for files

I am trying to allow the user to download an excel file, by using

Response.Redirect(
    "http://localhost/myapp/download_folder/example excel file_july.xls") 

in page load of an ASP.net page

but on the client side i a m getting the following screen in firefox 3.5

Firefox 3.5 shows blank download screen

You can observe that the file name and file type are shown as empty fields. The ok and cancel buttons are not doing anything.

This happens only in firefox 3.5, it is working in firefox later versions and other browsers.

I tried clearing the Response with Response.Clear(), using Response.BinaryWrite with the file byte array and even tried to open the file with the javascript by calling window.open(url).

Upvotes: 3

Views: 1180

Answers (1)

Davide Piras
Davide Piras

Reputation: 44605

you are doing it the wrong way.

just as an example, look at what is done in the question body here:

How to download file and reload

in your case you should probably use an overload of Response.Write.

the point is that you should set some Response headers to tell the browser file name, file length and content type at least.

Upvotes: 1

Related Questions