How to use HttpContext for custom file downloads

Hi Everyone. Thanks for any help in advance.

I couldnt really find an answer in the forums so far. Im using integration studio and have created the following action (for example)

            string outputText = "a,b,c,d";
            string attachment = "attachment; filename=TestDownload.csv";                        
            HttpContext.Current.Response.AddHeader("content-disposition", attachment);
            HttpContext.Current.Response.ContentType = "text/csv";
            HttpContext.Current.Response.AddHeader("Pragma", "public");

I works and causes a file download dialog to popup, but the contents of the file are not "a,b,c,d" but rather the content of the page with the button that invoked the action. What might I be missing? Perhaps Im approaching this the wrong way.
Hello Tyler,

   Do you want a outsystems page to download a file? 
   If so, it's very simple just create a new WebScreen with a preparation that ends with a download widget.
   To set custom headers just use the "AddHeader" action from the extension "HTTPRequestHandler".

André Pereira