Saturday, October 12, 2013

Post Parameters Exceeds Maximum Limit

In sometime I was making a “POST” AJAX request to server and it was working fine but latter I had to add few new form elements and then I made the POST AJAX call. Suddenly I got the error:

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.

I was using ColdFusion – 9 with IIS. After few searching I found that the problem is with no of form parameters present in the “POST” request. By default ColdFusion provides a default form element limit as “100”. If the no of parameter will exceed to that then we will get error message.

I run the same code in ColdFusion – 10 with Apache and I got the following error message:
POST parameters exceeds the maximum limit.

Then the question arises:

                    Will I get the same error for “GET” request?
                    How can I increase the limit in ColdFusion?

Will I get the same error for “GET” request?

No, for “GET” request you will not get such error . “GET” request depends on the URL length. I mean when you make any “GET” request all parameters are appended to the base URL and they pass in URL scope. Each browser have some limit to length of the URL it can process, if the URL length in “GET” request will exceed to that then you may get some error message or some unwanted result.

How can I increase the limit in ColdFusion?

            In ColdFusion – 9:
Go to {ColdFusion-Home}/lib for Server Installation
{ColdFusion-Home}/WEB-INF/cfusion/lib for Multiserver or J2EE installation.
Open file neo-runtime.xml, after the line.

<var name='postSizeLimit'><number>100.0</number></var>

add the below line and you can change the number 100 to your desired limit.
<var name='postParametersLimit'><number>100.0</number></var>

            In ColdFusion – 10:
Adobe has added an option in ColdFusion Admin to control the number of form elements. Go to
Settings”, you will see a screen like below:

You can change the highlighted section value from “100” to your desired form element limit.

NOTE: After doing all these you will see if you have provided “100” limit then you are able to pass only “99” form elements in post request I.e. 1 element less than the limit. Because when do any form post ColdFusion automatically added a field called “FIELDNAMES”.