0

I tried to send parameter from client to server with AJAX in ASP.NET but I met with this error. IIS version 8.5 .

my web config:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5.1"/>
    <httpRuntime targetFramework="4.5.1"  
                 maxRequestLength="10000000" 
                 executionTimeout="3600" 
                 maxQueryStringLength="1000000"
                 maxUrlLength="1048576"
                 appRequestQueueLimit="50000"
                 enable="true"
                 enableHeaderChecking="true"
                 minFreeThreads="8"
                 minLocalRequestFreeThreads="4"
                 relaxedUrlToFileSystemMapping="false"   
                 />      
    <pages controlRenderingCompatibilityVersion="4.0"/>
    <globalization
      fileEncoding="utf-8"
      requestEncoding="utf-8"
      responseEncoding="utf-8"
      culture="en-US"
      uiCulture="fa-IR"
    />
  </system.web>
 <system.webServer>
   <security>
     <requestFiltering>
         <requestLimits maxAllowedContentLength="2147483647" maxQueryString="2147483647" maxUrl="2147483647" />
     </requestFiltering>
   </security>   
 </system.webServer> 
</configuration>

Friends who's the solution?

Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
  • http://stackoverflow.com/questions/10122957/iis7-413-request-entity-too-large-uploadreadaheadsize – JKerny Feb 03 '17 at 00:37
  • What was the "parameter" ? Was it a file ? If so, how large ? What was *the error* ? More info please :) – sh1rts Feb 03 '17 at 00:55
  • tnx @JeremyKern. i added them. but the problem is not solved. –  Feb 03 '17 at 09:15
  • tnx @sh1rts. my parameter is a large string. for example : length = 2000 . just for send comment, i want to use them –  Feb 03 '17 at 09:16

2 Answers2

0

this is my ajax code:

var param_data = "pnumber_post=" + pnumber_post + ""
                                 + "&text_box_comment="+ text_box_comment+""
                                 + "&part=" + part + ""
                                 + "&page=" + page_english_persian + "";
http_req_post_comment.open("post", "post_comment_all.aspx", true);
http_req_post_comment.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
http_req_post_comment.setRequestHeader("Content-Length", param_data.length);
http_req_post_comment.send(param_data);
  • pnumber_post.length = 5.
  • text_box_comment.length = 2000.
  • part.length = 5.
  • page.length = 5.

Total strings used 2015. Sometimes when I click a few buttons short time to save the comment, the comment will be saved. But the ratio is 1 to 500.

  • Hi Behrad; still need more information. Can you post the server-side code (the target of the AJAX post) and - most importantly - what the error was ? – sh1rts Feb 06 '17 at 01:15
0

my customer server manager told me that you need to add:

<configuration> 
   <system.web.extensions>
       <scripting>
           <webServices>
               <jsonSerialization maxJsonLength="50000000"/>
           </webServices>
       </scripting>
   </system.web.extensions>
</configuration>

but, when i add up this code to configration file and when a parameter reaches 6,000... i meet (414 error).