/// <summary>
        /// Generic method that handles processing a Callback request by routing to
        /// a method in a provided target object.
        ///
        /// </summary>
        /// <param name="target">The target object that is to be called. If null this is used</param>
        public void ProcessCallbackMethodCall(object target, string methodToCall)
        {
            if (target == null)
            {
                target = this;
            }

            HttpRequest  Request  = HttpContext.Current.Request;
            HttpResponse Response = HttpContext.Current.Response;

            Response.Charset = null;

            CallbackMethodProcessorHelper helper = new CallbackMethodProcessorHelper(this);

            List <string> ParameterList = null;

            string contentType = Request.ContentType.ToLower();


            // check for Route Data method name
            if (string.IsNullOrEmpty(methodToCall) && target is CallbackHandler)
            {
                CallbackHandler chandler = target as CallbackHandler;
                if (chandler.RouteData != null)
                {
                    methodToCall = ((CallbackHandlerRouteHandler)chandler.RouteData.RouteHandler).MethodName;
                }
            }

            // Allow for a single XML object to be POSTed rather than POST variables
            if (contentType.StartsWith(ControlResources.STR_XmlContentType))
            {
                if (string.IsNullOrEmpty(methodToCall))
                {
                    methodToCall = Request.Params["Method"];
                }

                if (string.IsNullOrEmpty(methodToCall))
                {
                    WriteErrorResponse("No method to call specified.", null);
                    return;
                }

                // Pass a Parameter List with our JSON encoded parameters
                ParameterList = new List <string>();

                if (Request.ContentLength > 0L)
                {
                    // Pick up single unencoded JSON parameter
                    string singleParm = UrlUtils.FormBufferToString();

                    if (!string.IsNullOrEmpty(singleParm))
                    {
                        ParameterList.Add(singleParm);
                    }
                }
            }
            // Post AjaxMethodCallback style interface
            else if (contentType.StartsWith(ControlResources.STR_UrlEncodedContentType) && Request.Params["CallbackMethod"] != null)
            {
                // Only pick up the method name - Parameters are parsed out of POST buffer during method calling
                methodToCall = Request.Params["CallbackMethod"];
            }
            else
            {
                if (string.IsNullOrEmpty(methodToCall))
                {
                    methodToCall = Request.QueryString["Method"];
                }

                if (string.IsNullOrEmpty(methodToCall))
                {
                    WriteErrorResponse("No method to call specified.", null);
                    return;
                }
            }

            object Result                = null;
            string StringResult          = null;
            CallbackMethodAttribute attr = new CallbackMethodAttribute();

            try
            {
                if (ParameterList != null)
                {
                    // use the supplied parameter list
                    Result = helper.ExecuteMethod(methodToCall, target, ParameterList.ToArray(),
                                                  CallbackMethodParameterType.Xml, ref attr);
                }
                else
                {
                    // grab the info out of QueryString Values or POST buffer during parameter parsing
                    // for optimization
                    Result = helper.ExecuteMethod(methodToCall, target, null,
                                                  CallbackMethodParameterType.Xml, ref attr);
                }
            }
            catch (Exception ex)
            {
                Exception ActiveException = null;
                if (ex.InnerException != null)
                {
                    ActiveException = ex.InnerException;
                }
                else
                {
                    ActiveException = ex;
                }

                WriteErrorResponse(ActiveException.Message,
                                   (HttpContext.Current.IsDebuggingEnabled ? ex.StackTrace : null));
                return;
            }

            // Special return type handling: Stream, Bitmap, byte[] and raw string results
            // are converted and returned directly
            HandleSpecialReturnTypes(Result, attr, Request, Response);

            // Standard json formatting
            try
            {
                SerializationUtils.SerializeObject(Result, out StringResult);
            }
            catch (Exception ex)
            {
                WriteErrorResponse(ex.Message, HttpContext.Current.IsDebuggingEnabled ? ex.StackTrace : null);
                return;
            }


            // Explicitly set the content type here
            Response.ContentType = ControlResources.STR_XmlContentType;

            Response.Write(StringResult);
            Response.End();
        }