I have a web-based file upload/download mechanism using ServiceStack (5.11.0). The backend is running on Windows/IIS(Express).
It works for different file types (e.g. txt, pdf, xslx, docx, jpg, etc.), however trying to download a .csv file fails with a browser (Chrome/Edge) error:
ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION
I have no errors recorded in my log files and no backend exceptions thrown when debugging in Rider.
The essence of my download service is:
[Route("/filestore/file/{FileName}", "GET")]
public class GetFile : IReturn<HttpResult>, IGet
{
public string FileName { get; init; }
}
Implementation:
public object Get(GetFile request)
{
var fsroot = @"C"\temp";
var path = Path.Combine(fsroot, request.FileName);
var file = VirtualFiles.GetFile(path);
var mime = MimeTypes.GetMimeType(file.Extension);
var response = new HttpResult(file, mime, asAttachment: true);
return response;
}
Anybody know why csv files do not download?