Click here to Skip to main content
14,736,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi team,

My json ajax request not working on max query string in mvc 4 code.
my url not hit the controller jsonresult action.
when i send small no . of query string then its working.
Can you any body help me why its not working.

Below is my code.

strSelecteds = strSelecteds.substring(0, strSelecteds.length - 1);
$.ajax({
    url: "/Usermanagement/AddProxyGroupMapping?jsonValue=" + strSelecteds + '&IsInsert=' + IsInsert + '&PackageId=' + packegeId + '&Allocate=' + Allocate,
    type: 'POST',
    contentType: 'application/json;charset=utf-8'
});


The strSelecteds string have the max record with more the 1000 length.
I am using below code in webconfig file but its not working .

<system.web.extensions>
  <scripting>
    <webServices>
      <!-- Try increasing this value to a larger value (Int.MaxValue used below) -->
      <jsonSerialization maxJsonLength="2147483644"></jsonSerialization>
    </webServices>
  </scripting>
</system.web.extensions>


I want to know , how to handle max record through ajax request in mvc4

regards,
Ravi Sharma
Posted

1 solution

Since you're posting, do not send the data as if you're using GET. Set the fixed path
/Usermanagement/AdProxyGroupMapping and then use
"data: " to send what you need

like this:
strSelecteds = strSelecteds.substring(0, strSelecteds.length - 1);
$.ajax({
    url: "/Usermanagement/AddProxyGroupMapping",
    type: 'POST',
data: {'jsonValue': strSelecteds, 'IsInsert': IsInsert, 'PackageId': packageId, 'Allocate': Allocate }
    contentType: 'application/json;charset=utf-8'
});



You might need to tweak this, data needs to be JSON, maybe I misspelled something, but sending long query string (which is limited to around 2000 characters in IE and 4000 total) is not a good idea.

Since you are using POST method, send the data as for post.


If this helps please take time to accept the solution. Thank you.
   
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



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