Click here to Skip to main content
15,921,371 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
hi all
i created .zip file in webservice and allow user to user to see "OPen , Save , Cancel" window from javascript using this code
function Export_Report_Sucess(result)

but when run this , googleCrome and the rest of browsers except IE didn't appear window however the file was downloaded sucessfully

can any one tells me why and how can i solve this


Make sure in your server side code you have following lines to force the file open/save as dialog.
//Add the file name and attachment, to force the open/save dialog to show
Response.AddHeader("Content-Disposition", "attachment;filename="+ FileName.Name);

//Add the file size into the response header
Response.AddHeader("Content-Length", (FileName.Length - startBytes).ToString());

Also suggest you to go through this article here on CodeProject.

Share this answer
Prasad Khandekar 5-Jun-13 9:25am    
Also suggest you to do the changes in client side script given in Solution by artefakt94.

First, window.location.href is not a function.
Use this :
window.location.href = result;
Share this answer
Prasad Khandekar 5-Jun-13 9:26am    
Nice. I totally missed it. +5.
NNos2012 6-Jun-13 6:58am    
me too , thanks alot
Ahmed Bensaid 6-Jun-13 9:05am    
You're welcome ;)
This[^] might help you.
Share this answer

you can do one thing.(so that you don't have to face the browser problem.)

When you get the result (eg: .zip file) you can load Popup Window like this.

step 1: Create Div based section in your web page

<div id="dialog" style="display:none">
<![CDATA[<%--  Add File Name with download link -- %>]]>

Step 2: Write JavaScript to show dialog in popup
function ShowDialog(isValidAddress) {
function HideDialog() {

step 3: Call javascript function showDialog from Code behind.


Refer this link better idea[^]

If this will help you then please accept this as answer and vote for this.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900