"The data area passed to a system call is too small." With window.location.href and a custom URL protocol.

Answered "The data area passed to a system call is too small." With window.location.href and a custom URL protocol.

  • 14 พฤษภาคม 2555 15:12
     
      มีโค้ด

    Hello,

    I have created a URL Protocol (cfrmisplugin://) as directed by MSDN which points to an application on my local machine.  See this article here: http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85)

    I am then building a URL which I then navigate to using JavaScript.  Essentially the URL contains information to be passed to the client application (URL handler) which is then processed and in turn launches Microsoft Word.  The code below demonstrates my URL building function (using ExtJS) and then calling window.location.href to carry out the launching:

    launchLetter: function (LC, ST, SF, TK, UH, TA) {
            var loca = Ext.urlEncode({
                AC: 'LETT',
                LC: LC,
                CS: txtCS.getValue(),
                ST: ST,
                SF: SF,
                TK: TK,
                LW: txtLW.getValue(),
                HP: txtHP.getValue(),
                LH: txtLH.getValue(),
                LP: txtLP.getValue(),
                UH: Ext.value(UH, false),
                TA: Ext.value(TA, '')
            }, 'CFRMISPlugin:IE=' + (Ext.isIE ? 'true' : 'false')
            );
    
            window.location.href = loca;
        }

    This produces a URL as shown below:

    CFRMISPlugin:IE=false&AC=LETT&LC=NOREP&CS=mfY%2BZS9dEp6s5XX7kdaAjZKLKQUYYGZE5JqlE6jk86jxtp9s8iFt%2F16cS0SXS8hMGr5mluHTC6BJq3mT7o8UxOHdA2eLCp%2Bj2QiVekB%2FSsVwDSS11PyjYMkNWfNFGfOV%2BJrL%2Fe01W4uLPZyfs6B3yn6DX6BupOWpdGwibpV3%2FTjG4zxiV%2BRxRIdlVmT9XVrS&ST=PREMISE%20X%2C%20premise%20p%20inner%20join%20(select%20premid%20from%20miscvisit%20m%20inner%20join%20ra_responseheader%20rh%20on%20m.jobno%20%3D%20rh.jobno%20where%20rh.model%20%3D%20'i'%20and%20m.compdate%20%3E%3D%20'01%2FAPR%2F2011'%20group%20by%20premid%20having%20count(*)%20%3E%3D%203)%20d3orMore%20%20on%20%20d3orMore.premid%20%3D%20p.premid&SF=x.premid%3Dp.premid%20AND%20P.%20Metarea%20%3D%20%40rpt_District%20and%20P.STATION%20%3D%20%40rpt_Station%20and%20NOT%20EXISTS%20(SELECT%201%20FROM%20MISCVISIT%20M%20INNER%20JOIN%20RA_RESPONSEHEADER%20RH%20ON%20M.JOBNO%20%3D%20RH.JOBNO%20AND%20M.PREMID%20%3D%20P.PREMID%20AND%20RH.MODEL%20%3D%20'D')%20and%20not%20exists%20(select%201%20from%20letterhist%20l%20where%20l.premid%20%3D%20p.premid%20and%20l.summary%20like%20'%25HFSC%20No%20Replies%20Letter%25'%20and%20l.sentdate%20%3E%3D%20'01%2Fapr%2F2011')%20&TK=PREMID&LW=false&HP=false&LH=true&LP=true&UH=true&TA=X

    Now, the URL above is 1174 characters long and produces the following error on the window.location.href line:

    SCRIPT122: The data area passed to a system call is too small.

    If I use a shorter URL then the call appears to work fine.  The only information I can find relating to the length of usable URLs is 2083 characters, referencing:

    http://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string

    and interestingly the Win32Exception detailed on this page:

    http://msdn.microsoft.com/en-us/library/0w4h05yb(v=vs.90).aspx

    I see a lot of information relating to this error on the Internet but never a solution.  I have disabled Script Debugging and the likes within Internet Explorer as suggested by some but this has no effect.  I am clearly reaching a limit with a component somewhere but don't know why.  I have also tested with a URL that is 'cfrmisplugin://AAAAAAAAAA.....' to see if it was a specific character in my URL but this is not the case.  I have worked out that it falls over when the character length is around 512.

    Any help would be much appreciated.


    • แก้ไขโดย PsyVision 14 พฤษภาคม 2555 15:44
    •  

ตอบทั้งหมด