I am using an ajax PageMethod to call an asp.net webmethod. From there I'm trying to pass a lot of XML back to a callback javascript function.
Currently I just convert the XML into a string and pass it in that format. But it seems that if the string is too long it causes an error.
Here's the VB:
<System.Web.Services.WebMethod()> _
Public Shared Function getXML() As String
   Dim strXML
   strXML=getLoadsOfXML().InnerXml;
   Return strXML
End Function
Here's the javascript:
function loadGrid(){
    PageMethods.getXML(myCallback);
} 
//This function doesn't get called if strXML is too long
function myCallback(strXML){
    useXML(strXML);
}
Here's the error:
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'getXML' failed with the following error: System.InvalidOperationException-- Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
So my question is: Is there a better way to pass the XML from VB to javascript, or a way to allow large strings to be passed without error?
 
     
     
    