Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to send large string more than 300k characters from server to client side.
for less character its works fine but if i send large data it gives me error at client side at GetVal()
ScriptResource.axd?d=ZcwVAK_NOhic4vV9c3pDrDgVOGeXTSmbV_h4hrB4AYvCck3CzugURz2Hh_coReQTH7g2Ic1Q-zr149y9DQxensyPFeoHX0_89UV7i63FJ5OMUYEZYqd0AqrTxEX33GzUL3THCXUISUSAdnLW_M1p5h7si3pju0-GYZycWvLFRcYN_zu_LztKZOOtUeyfUR-e0&t=3d0d00d7:6076 POST http://localhost:60125/...../GetVal 500 (Internal Server Error)


Please help me for this

What I have tried:

Java script:
JavaScript
PageMethods.GetVal(x, onRequestComplete, onError);


server side vb:
<System.Web.Services.WebMethod()> _
   Public Shared Function GetVal(ByVal x As String) As String
     Dim a As String
    //logic to get a value from db using x value
     Return a
   End Function
Posted
Updated 17-Oct-17 7:37am
Comments
Kornfeld Eliyahu Peter 17-Oct-17 8:46am    
What error do you get?
Nitin Surya 17-Oct-17 8:51am    
mentioned above
ScriptResource.axd?d=ZcwVAK_NOhic4vV9c3pDrDgVOGeXTSmbV_h4hrB4AYvCck3CzugURz2Hh_coReQTH7g2Ic1Q-zr149y9DQxensyPFeoHX0_89UV7i63FJ5OMUYEZYqd0AqrTxEX33GzUL3THCXUISUSAdnLW_M1p5h7si3pju0-GYZycWvLFRcYN_zu_LztKZOOtUeyfUR-e0&t=3d0d00d7:6076 POST http://localhost:60125/...../GetVal 500 (Internal Server Error)
Nitin Surya 17-Oct-17 8:53am    
if i cut down the string then its works fine, but for big string gives me 500 internal server error
Kornfeld Eliyahu Peter 17-Oct-17 8:56am    
Have you debugged the server side? Maybe there is a time-out that turns to be 500?
Nitin Surya 17-Oct-17 9:21am    
i put msgbox just before return and string is ok in msgbox...that means there is no time out

1 solution

You're probably exceeding the maximum response length:
maxJsonLength Specifies the maximum length of the JSON string (the maximum number of UTF-8 characters). The default length is 102400.

Change the settings in your web.config file to increase the maximum:
XML
<configuration>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="500000"/>
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>
 
Share this answer
 
Comments
Nitin Surya 17-Oct-17 13:02pm    
Perfect. Thank you... it worked

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900