[CLOSED] Reponse Type on a direct method

  1. #1

    [CLOSED] Reponse Type on a direct method


    I am trying to return a byte array from server side code to jscript via a direct method and cant get it working. Is this the correct syntax? The below succeeds but returns a string as opposed to the byte array.

    App.direct.MyMethod(p1, {              
                    responseType: 'arraybuffer',
                    xhr2: true,              
                    success: function (result) {
    public byte[] MyMethod(p1)
    Last edited by fabricio.murta; Aug 28, 2017 at 9:29 PM.
  2. #2
    You can close this as it can't be an Ext problem as I created a c# handler and called it directly from an xmlhttprequest and nothing is returned.

    Solutions I found for my problem were

    1. Convert the base64 string on the client (direct method) or
    2. Just write the entire stream from the handler to the reponse and using an object tag or iframe to display the content
  3. #3
    Hello @CanopiusApplications!

    Thanks for the proactive feedback! And this makes sense. Best I can think using Ext.NET would what you said. Encapsulating the binary data (base64 or MIME are good ways), and return them as string, then working with that on the callback.

    Other than that, it could involve actually making it act as a download and write the data to the "download" stream then working with that. Which involves making Ext.NET not handle the response at all.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Hi Fabricio

    Yeah ultimately what I did was simply write everything to the stream and work with that. I got the base64 conversion, then blob & then createObjectURL working however I thought it must be slower this way given the conversions and pretty sure I read somewhere there are size limits with the base64 string.

    A related thread here : https://forums.ext.net/showthread.ph...nel-and-Iframe

    Thanks for responding,

Similar Threads

  1. [CLOSED] Direct Method - App.direct undefined
    By registrator in forum 2.x Premium Help
    Replies: 4
    Last Post: Jul 23, 2014, 2:47 PM
  2. Replies: 2
    Last Post: May 13, 2014, 9:52 AM
  3. Replies: 0
    Last Post: Nov 12, 2013, 9:08 PM
  4. [CLOSED] Output Cache issue with Direct Method / Direct Event
    By amitpareek in forum 1.x Premium Help
    Replies: 18
    Last Post: Mar 01, 2013, 6:03 AM
  5. Direct method and direct event over SSL?
    By dimitar in forum 1.x Help
    Replies: 0
    Last Post: Oct 08, 2011, 9:09 PM

Posting Permissions