Can you post the solution to this issue as i have the same problem. I have an activity that uses @baseclass.DownloadFile to download a file. It work when i run it the activity from designer studio but i can't get it to work when called from UI in a case. I've tried both the suggested fixes and nether work for me.
You need to put the call to DownloadFile into an Activity record, and then use the "Open URL in new Window" action on a UI control, calling your Activity, in order for this to work.
You may also have success from doing a "reload section" and running the Activity as part of that reload.
The explanation I have just been given for this behavior is "Simply running Activity is an ajax request with a pass/fail response, so the browser (currently in the Pega UI) is not expecting an HTTP payload with a file in it and will not be handling it. When you do an Action such as Open URL in new Window, you are pushing the data to the browser as data for it to consume (not as part of a pass/fail response), and it will handle it accordingly."