Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
335
ASP Core Middleware improperly encodes serverMessage
posted

Hi Ignite team,

We have to send some additional data to the client side javascript, more specifically in the iguploadfileuploaded event.
To do that, we bind to FinishingUploadEventHandler and put that data in UploadFinishingEventArgs.ServerMessage.


This works fine in ASP.NET, but we are in the process of upgrading to ASP.NET Core 2.1. Both on Framework runtime.
The new Middleware for Core mostly works fine. Except for this ServerMessage.

In old ASP we get the response from ig_fua34sf345sdf13sdf3454erdsf2345asd3425df5235d54df345.aspx as expected:

<root><serverMessage>{"FileId":null,"Filename":"80831.HA.Mono.pdf","Path":"D:\\Temp\\TempUpload\\igUploadAgencyUploader\\80831.HA.Mono.pdf"}</serverMessage></root>

But in Core there are null chars in between the regular chars:

I can't even copy-paste the text here because windows clipboard thinks the text terminates after the first null. And javascript probably thinks the same, because the fileuploaded event is triggered with an empty serverMessage.

It looks like maybe Kestrel is expecting UTF8 and the middleware is writing UTF16, leaving 1 char gaps?

Parents
No Data
Reply
  • 0
    Offline posted

    Github might not be the best place for this, in my opinion. Because the middleware is closed-source and not part of that repo.

Children
No Data