IgniteUI / ignite-ui

Ignite UI for jQuery by Infragistics

Home Page:https://bit.ly/2kuu1fT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASP Core Middleware improperly encodes serverMessage

rdeprins opened this issue · comments

Hi Ignite team,

I'm not sure if this is the right location for Middleware issues, since Infragistics.Web.AspNetCore is not open-source. But I was referred to here from the Infragistics forums: https://www.infragistics.com/community/forums/f/ignite-ui-for-asp-net-mvc/124959/asp-core-middleware-improperly-encodes-servermessage

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.2. 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.
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?

Steps to reproduce

  1. Create new .Net Framework 4.7.2 web project using ASP Core 2.2.0
  2. Set up middleware as instructed here https://www.igniteui.com/help/using-igniteui-controls-in-asp.net-core-project#middleware
  3. Bind to server-side event UploadFinishing as instructed here https://www.igniteui.com/help/igupload-using-server-side-events
  4. Set serverMessage in this event
  5. Observe the browser network debugger.

Result

What is the actual result after following the steps to reproduce?
See screenshot

Expected result

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