Question

my client using jQuery 1.7 try to make a request to my server using ASP.Net MVC 3 Json method. I will give a shot of my request like this below:

GET http://www.domain.com/GetReq?allMounted=&clusterMounted=&ids=30610270%3B518443402%3B524472053%3B526202914%3B530431939%3B532547899%3B536637280%3B541356006%3B545440588%3B554550099%3B555233306%3B563618755%3B567105315%3B571186496%3B571465797%3B573193634%3B574928208%3B581852411%3B582924369%3B586547013%3B590785283%3B598551031%3B604447975%3B604453786%3B605872780%3B609914788%3B610253930%3B622380143%3B629483834%3B630574516%3B634440693%3B643310215%3B650649639%3B651494188%3B651924756%3B652461742%3B656962313%3B661918945%3B661998339%3B664159349%3B664324800%3B665830535%3B666119895%3B669042740%3B669487771%3B671818043%3B674163610%3B679703080%3B679896885%3B680091381%3B685109708%3B692204469%3B692352393%3B693576505%3B693928505%3B699488218%3B701739208%3B703143157%3B703300211%3B704147427%3B704352069%3B706628328%3B707212201%3B710302950%3B717950556%3B718247850%3B718919677%3B719122851%3B719327908%3B721589487%3B723456023%3B724313618%3B730053692%3B730213552%3B730772971%3B731063017%3B732807275%3B734153852%3B741814595%3B744021831%3B747573207%3B757513263%3B761994028%3B764849512%3B768416191%3B778049378%3B787958910%3B796159721%3B809959098%3B813053535%3B824155955%3B828627299%3B829283957%3B839005746%3B840872511%3B843484646%3B844689451%3B845054629%3B848234476%3B852765233%3B1000576937%3B1004304958%3B1008047991%3B1015473777%3B1017743491%3B1020619341%3B1020634556%3B1022678407%3B1023262389%3B1027385681%3B1027928195%3B1035250530%3B1035682459%3B1052977966%3B1053597503%3B1053698030%3B1053732688%3B1055380176%3B1056809377%3B1058587382%3B1060608663%3B1063400405%3B1070533909%3B1071767114%3B1071960619%3B1083176585%3B1086503710%3B1087028651%3B1098303369%3B1102757875%3B1109486064%3B1114196865%3B1116084571%3B1118574365%3B1121530847%3B1131787898%3B1131844471%3B1139894525%3B1143831375%3B1152161894%3B1158181182%3B1162073970%3B1164303696%3B1169673373%3B1172231885%3B1173130469%3B1183431189%3B1196034452%3B1198250613%3B1198982056%3B1206280376%3B1234018094%3B1239793079%3B1247503402%3B1257937702%3B1259277492%3B1261616635%3B1261878519%3B1262185875%3B1262445302%3B1262860806%3B1279208856%3B1283016457%3B1286422809%3B1287099230%3B1290921212%3B1293397307%3B1295115242%3B1299756204%3B1301842759%3B1301894500%3B1303104957%3B1308482429%3B1309907587%3B1315291027%3B1316680391%3B1320260852%3B1320939128%3B1330608951%3B1331857064%3B1336024766%3B1338002765%3B1338164896%3B1340123828%3B1341027466%3B1364370718%3B1372797126%3B1374493422%3B1379764795%3B1385935903%3B1386666983%3B1388194610%3B1394134884%3B1396579405%3B1397262202%3B1413500064%3B1416054712%3B1416278524%3B1419585672%3B1423117714%3B1425565353%3B1425724864%3B1428687609%3B1431258197%3B1432462685%3B1443510711%3B1451771231%3B1461466444%3B1466047615%3B1468071638%3B1469403287%3B1469967488%3B1472741560%3B1476414128%3B1481087253%3B1496143753%3B1498819694%3B1527222617%3B1528932311%3B1543536576%3B1546344746%3B1550691037%3B1561694613%3B1566066725%3B1566708962%3B1574505614%3B1579232428%3B1586513572%3B1589304316%3B1594473889%3B1594832634%3B1603731306%3B1604595394%3B1609852565%3B1613941523%3B1616079433%3B1640532852%3B1647785629%3B1647818850%3B1652657165%3B1652692462%3B1654162596%3B1665113660%3B1671666642%3B1673079987%3B1674924955%3B1684864348%3B1686953559%3B1696398912%3B1707110056%3B1723821296%3B1725502898%3B1734295296%3B1738519132%3B1766790244%3B1770533548%3B1790070772%3B1806074453%3B1811074491%3B1816601020%3B1825935025%3B1831602865%3B1833842830%3B1840845367%3B1845821959%3B1848783678%3B100000016449937%3B100000019867713%3B100000026477681%3B100000029297898%3B100000035209870%3B100000045910860%3B100000052168531%3B100000064429697%3B100000075943822%3B100000081384508%3B100000081625223%3B100000101565871%3B100000113205523%3B100000114450197%3B100000117235726%3B100000120592690%3B100000136610153%3B100000138631630%3B100000145338135%3B100000167190323%3B100000174560028%3B100000177933371%3B100000188166652%3B100000190981209%3B100000221733230%3B100000250747936%3B100000260544345%3B100000299484386%3B100000309574997%3B100000340054929%3B100000341466714%3B100000387311865%3B100000398435130%3B100000407242074%3B100000417740773%3B100000419520193%3B100000421796247%3B100000452581205%3B100000462064468%3B100000508106410%3B100000517696868%3B100000524301515%3B100000576789119%3B100000583457306%3B100000597264802%3B100000607913679%3B100000676513831%3B100000692781035%3B100000733864194%3B100000774336252%3B100000830847624%3B100000847736287%3B100000853715298%3B100000856045877%3B100001001895214%3B100001029519786%3B100001093536134%3B100001157343775%3B100001220835854%3B100001230609233%3B100001381358286%3B100001405028095%3B100001440467822%3B100001481025895%3B100001494495513%3B100001530916865%3B100001534554460%3B100001544507518%3B100001558721850%3B100001614355131%3B100001645000011%3B100001986328418%3B100002073097971%3B100002352400400%3B100002383841123%3B100002637920147%3B100002795361523%3B100002852964846%3B100002897727776%3B100003116356881%3B100003319830274%3B100003333136152%3B100003713341268&requesterMail=something%40hotmail.com

and I got the result with "400 (Bad Request)", is something wrong with my request? or shall I divide my request into several request?

ids was containing list of id with semicolon separator.

Was it helpful?

Solution

If your query string exceeds maxQueryStringLength ASP.NET will return a 400 (Bad Request) status.

This setting defaults to 2048, you can increase it, however, browsers also restrict the query string / url length, for example IE9 allows a maximum of 2083 characters.

If you can change the code, instead of using $.getJSON with a long query string I would send the data via a POST request using $.post with the dataType: json:

$.post(yourUrl, yourData, function (data) {
     // data has the same value as if you used $.getJSON
}, 'json');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top