I have the following controller action used to export a csv file
public ActionResult ExportExcel(int projectId)
        {
            var risks = new RiskRepository().GetRisksByProjectId(projectId);
            var commaDelimmeted =
                    risks.Select(
                        r => r.RiskDescription + "," + r.RiskTypeId.ToString() + "," + r.Likelihood.ToString() + "," + r.Impact + "," + r.Action + "," + r.ActionBy + ",")
                        .ToList();
            string data = commaDelimmeted.Aggregate(string.Empty, (current, line) => current + line + Environment.NewLine);
            Response.ClearContent();
            Response.Buffer = true;
            // set the header
            var aliasName = "someFile.csv";
            Response.AddHeader("content-disposition", "attachment; filename=" + aliasName);
            Response.ContentType = "application/csv";
            Response.Charset = "";
            Response.ContentEncoding = Encoding.UTF8;
            Response.Output.Write(data);
            Response.Flush();
            Response.End();
            return File(Response.OutputStream, "application/csv");
        }
The output csv file do not show right to left langauge characters properly, so I've set response content encoding header the problem still exists.
Any thoughts?
Edit : Looking at Darin's solution in this post didn't fix my problem , the output shows System.Byte[] in the csv output file.
 
     
     
    