How To Download A File From A Modal Dialog That Posts Back To Itself?
ASP.Net Webforms pages are wrapped in a massive form, which restricts other forms on the page because nested forms don't work. This is intentional because in a webforms project, t
Solution 1:
After quite some time researching and building a small test case, I found out that there are several interesting factors here.
- Response.WriteFile() works fine in webforms, even when the form is set with a target of the current window.
- Modal dialogs can download files perfectly fine, unless the form is set to the target of the current window.
Through extensive testing, this appears to be an obscure bug, or perhaps even a strange attempt at security. This also appears to be specific to IE 8, though I didn't get to test other versions of IE.
The trick to allowing the download inside the modal dialog is to change the form's target.
functiondownloader() {
document.getElementById("form1").target = "_blank";
}
This fixes the IE bug and appears to work in all other browsers (though I couldn't get opera to show the pop up at all, even with "allow all popups").
Thought my day of toiling shouldn't go to waste and maybe this will help someone else in the future.
Post a Comment for "How To Download A File From A Modal Dialog That Posts Back To Itself?"