I am trying to download a csv file in mvc from my angularjs code but instead of downloading it is showing a page with
StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StringContent, Headers: { Content-Type: text/comma-separated-values Content-Disposition: attachment; filename=test Content-Length: 276 }
Server Side Code
ActionName("ExportToCSV")]
    public HttpResponseMessage PostCSVDomainWiseReports(ReportFilterModel reportFilter)
    {
        var csvReport = _csvService.GetCsvReports(reportFilter);
        if (csvReport.NoDataForTheDateRange)
        {
            return new HttpResponseMessage(HttpStatusCode.NoContent);
        }
        var csvValidRequestResult = new HttpResponseMessage(HttpStatusCode.OK){Content = new StringContent(csvReport.Data)};
        csvValidRequestResult.Content.Headers.ContentType = new MediaTypeHeaderValue("text/comma-separated-values");
        csvValidRequestResult.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"){FileName = csvReport.FileName};
        return csvValidRequestResult;
    }
Angular js code
$scope.getCsvReports = function () {
    window.open($scope.getReportUrl("csv"), '_blank', '');
};
