开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜