Project info:
Patform: Wndows
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ServiceStack.Core" Version="5.8.1" />
</ItemGroup>
===============================================
[Route("/files/{fileId}", "GET")]
public class Files {
public string FileId{ get; set; }
}
public object Get(Files request) {
var targetFile = getFile();
var httpResult = new HttpResult(targetFile, asAttachment: true);
return httpResult;
}
if the file name contains cyrillic symbols from the request headers are not sent.
like this:
fileName = āŠŗŠ°ŠŗŠ¾Š¹ ŃŠ¾ ŃŠ°Š¹Š».xlsā; //not working
fileName = āsample file.xlsā;//works
httpResult contains āContent-Dispositionā in headers, but the headers are lost and do not reach the client
incorrect recuest headers:
as the name of the file is sent to the FileId
HTTP/1.1 200 OK
Date: Thu, 20 Feb 2020 15:30:28 GMT
Content-Type: application/excel
Server: Kestrel
Content-Length: 254745
Cache-Control: max-age=600
Last-Modified: Wed, 28 Aug 2019 07:33:10 GMT
Vary: Accept
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Overwrite, Destination, Content-Type, Depth, User-Agent, Translate, Range, Content-Range, Timeout, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Location, Lock-Token, If
Access-Control-Allow-Methods: ACL, CANCELUPLOAD, CHECKIN, CHECKOUT, COPY, DELETE, GET, HEAD, LOCK, MKCALENDAR, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, REPORT, SEARCH, UNCHECKOUT, UNLOCK, UPDATE, VERSION-CONTROL
Access-Control-Expose-Headers: DAV, content-length, Allow
X-Powered-By: ServiceStack/5.81 NetCore/Windows
correct request headers:
HTTP/1.1 200 OK
Date: Thu, 20 Feb 2020 15:32:31 GMT
Content-Type: application/excel
Server: Kestrel
Content-Length: 254745
Cache-Control: max-age=600
Last-Modified: Wed, 28 Aug 2019 07:33:10 GMT
Vary: Accept
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Overwrite, Destination, Content-Type, Depth, User-Agent, Translate, Range, Content-Range, Timeout, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Location, Lock-Token, If
Access-Control-Allow-Methods: ACL, CANCELUPLOAD, CHECKIN, CHECKOUT, COPY, DELETE, GET, HEAD, LOCK, MKCALENDAR, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, REPORT, SEARCH, UNCHECKOUT, UNLOCK, UPDATE, VERSION-CONTROL
Access-Control-Expose-Headers: DAV, content-length, Allow
X-Powered-By: ServiceStack/5.81 NetCore/Windows
Content-Disposition: attachment; filename="sample file.xls"; size=254745; creation-date=Thu 20 Feb 2020 15:00:23 GMT; modification-date=Wed 28 Aug 2019 07:33:10 GMT; read-date=Thu 20 Feb 2020 15:00:23 GMT
as you can see in the screenshot, the headers have:
the problem is on .net framework is not reproduced (test in .net 4.8)
Please help razobratsya with the problem.
Thanks in advance.