Code Project

Link Unit

Tuesday, April 28, 2009

How to Solve Method Error 500 - Maximum Length Exceeded with AJAX web service call

At client side I've been assigned a bug concerning
a combo box. When the combo box is changed by the
user, a secondary combo box has its values reloaded.
This is done by calling a web service. The bug is
that "Method Error 500" is displayed as the only
item on occasion. I checked and cross checked the
problem with my own post
http://jatindersingh.blogspot.com/2008/03/method-error-12030.html  ,
but could not sort the error , search on google lead to
the following solution.
 
Solution:
After some rooting around, it turns out that this is
caused by too much data being returned in the SQL query
behind the web service call, so the web service returns
an error. A simple change to the web.config file can
increase the size limit of data returned:
 
<system.web.extensions>
  <scripting>
    <webServices>
       <jsonSerialization maxJsonLength="5000000" />
    </webServices>
  </scripting>
</system.web.extensions>
 
Explaination:
First off, the serialization process will fail if the
number of nested objects is greater than that defined
within the RecursionLimit property , which is 100.
The serialization process will also fail if the length
of the serialized text is greater than that of the
MaxJsonLength property; again, note the default value
of 2,097,152 base ten.
Source http://www.codeproject.com/KB/ajax/ajax_json_serialization.aspx 

Hope visitor find it useful.

Wednesday, April 15, 2009

string.Empty Example and Issues in C# written by Sam Allen

string.Empty Example and Issues in C# written by Sam Allen

Problem. You are wondering how to use string.Empty and how it is different from an empty string literal constant "". There is a subtle different, and it can be significant in some scenarios, in that it changes the meaning of your program. Solution. Here we see how to use string.Empty, and then look into its implementation, finally seeing an example of how it can produce less effective code.

For more information click here  http://dotnetperls.com/Content/string-Empty.aspx

Tuesday, April 14, 2009

Crystal Reports Toolbar Images Displaying as Red X

Recently we developed reports for our web application in crystal report, but we faced the problem of toolbar images displaying as red X. On development machine it worked perfectly but on Production Server it failed to display.

Solution:

Copy aspnet_client folder from your PC and paste it in application folder on server ,then refresh the IIS default website and its done. It solved the problem for me I hope it help visitors too.