Last post Sep 29, 2014 08:45 AM by PatriceSc
Sep 29, 2014 01:16 AM|Rehaan|LINK
I am exporting and saving the excel file. After saving the file the page is still doing some processing. To abort that processing i need to redirect the page. If I' redirect the page the SaveFileDilaog doesn't appear. If it appears at that time the page
does not redirect. Please give some solution. THis is my code:
Response.ContentType = "Application/x-msexcel";
Response.AddHeader("content-disposition", "attachment;filename=" + GetCustomerUserID() + "_UserList.csv");
Sep 29, 2014 08:45 AM|PatriceSc|LINK
Redirect can't be used if you already sent some content (this information is part of an HTTP header and there is no point in sending some content if this is to move away immediately somewhere else).
Anyway as you are sending back non html content type, the code you shown should trigger an open/save as dialog without replacing the current HTML markup shown in the browser (as what you sent is not text/html content). So there is no point to redirect somewhere
are anyway you don't move away from what you previously shown.
What is the problem if you don't redirect at all ? What is this processing? Is this something you do or is this some kind of behavior that is unexpected? We would need then to better understand what is the bad behavior you see to be able to suggest how to
fix it (a redirection being liekly not the way to solve that).
Ah could it be that you still send some HTML markup after having sent the Excel content?