2

I read Luchian's suggestion on this link

Download Excel file via AJAX MVC

and I do like his idea very much that way I can avoid potentially saving 2 copies of the spreadsheet. Or having to worry about deleting the initial file that gets saved on the server before the AJAX call returns.

So if I save the spreadsheet as a memorystream and insert it into a unique Cache variable say cache_uniq1 and return that on the AJAX call, how would I then open the stream?

Can I just do window.open?

$.ajax({    
    type: 'POST',    
    url: '/Reports/Somepage.aspx',     
    data: '{ "dataprop1": "test", "dataprop2" : "test2" }',    
    //contentType: 'application/json; charset=utf-8',    
    //dataType: 'json',    
    success: function (returnValue) {   

        //window.location = /Reports/Download?file=' + returnValue;    
        //    
        //NOTE: Instead the returnValue = cache_uniq1 which is the unique Cache     
        //variable name that holds the Excel spreadsheet as a memory stream
    }
});

Any help is greatly appreciated. FYI my application is a straight on ASP.Net Web site (not using MVC).

Community
  • 1
  • 1
user428602
  • 47
  • 2
  • 11

0 Answers0