I am using a C# api and I call it from the from the UI, I am able to call it and I can see when I inspect the browser response, the returned data from the api, but it didn't force it to download the response. Here is the code I am using in the C# api
var response = HttpContext.Current.Response;
response.Clear();
string fileName = CleanFileName(string.Format("{0} test - {1}.txt", name, DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss")));
response.AddHeader("content-disposition", "attachment; filename = \"" + fileName + "\"");
response.ContentType = "text/csv";
response.AddHeader("Pragma", "must-revalidate");
response.AddHeader("Cache-Control", "must-revalidate");
byte[] byteArray = Encoding.UTF8.GetBytes(mydata);
response.AppendHeader("Content-Length", byteArray.Length.ToString());
response.BinaryWrite(byteArray);
response.End();
response.Flush();
Thanks