开发者

Firefox response.redirect not working for files

开发者 https://www.devze.com 2023-03-27 09:47 出处:网络
开发者_运维问答I am trying to allow the user to download an excel file, by using Response.Redirect(
开发者_运维问答

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 response.redirect not working for files

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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消