/// <summary>
        /// Returns an error response to the client from a callback. Code
        /// should exit after this call.
        /// </summary>
        /// <param name="ErrorMessage"></param>
        public void WriteErrorResponse(string errorMessage, string stackTrace)
        {
            CallbackException Error = new CallbackException();

            Error.message         = errorMessage;
            Error.isCallbackError = true;
            Error.stackTrace      = stackTrace;

            JSONSerializer Serializer = new JSONSerializer();
            string         result     = null;

            SerializationUtils.SerializeObject(Error, out result);

            HttpResponse Response = HttpContext.Current.Response;

            Response.ContentType = ControlResources.STR_XmlContentType;

            Response.TrySkipIisCustomErrors = true;

            if (Response.StatusCode == 200)
            {
                Response.StatusCode = 500;
            }

            Response.Write(result);
            //HttpContext.Current.ApplicationInstance.CompleteRequest();
            Response.End();
        }
예제 #2
0
        /// <summary>
        /// Returns an error response to the client from a callback. Code
        /// should exit after this call.
        /// </summary>
        /// <param name="ErrorMessage"></param>
        public void WriteErrorResponse(string errorMessage, string stackTrace)
        {
            CallbackException Error = new CallbackException();

            Error.message         = errorMessage;
            Error.isCallbackError = true;
            Error.stackTrace      = stackTrace;

            JSONSerializer Serializer = new JSONSerializer(SupportedJsonParserTypes.JavaScriptSerializer);
            string         result     = Serializer.Serialize(Error);

            if (!string.IsNullOrEmpty(JsonPMethod))
            {
                result = JsonPMethod + "( " + result + " );";
            }

            HttpResponse Response = HttpContext.Current.Response;

            Response.ContentType = ControlResources.STR_JsonContentType;

            Response.TrySkipIisCustomErrors = true;

            // override status code but only if it wasn't set already
            if (Response.StatusCode == 200)
            {
                Response.StatusCode = 500;
            }

            Response.Write(result);

            Response.End();
        }
        /// <summary>
        /// Returns an error response to the client from a callback. Code
        /// should exit after this call.
        /// </summary>
        /// <param name="ErrorMessage"></param>
        public void WriteErrorResponse(string errorMessage, string stackTrace)
        {
            CallbackException Error = new CallbackException();
            Error.message = errorMessage;
            Error.isCallbackError = true;
            Error.stackTrace = stackTrace;

            JSONSerializer Serializer = new JSONSerializer();
            string result = null;
            SerializationUtils.SerializeObject(Error, out result);

            HttpResponse Response = HttpContext.Current.Response;
            Response.ContentType = ControlResources.STR_XmlContentType;

            Response.TrySkipIisCustomErrors = true;

            if (Response.StatusCode == 200)
                Response.StatusCode = 500;

            Response.Write(result);
            //HttpContext.Current.ApplicationInstance.CompleteRequest();
            Response.End();
        }
        /// <summary>
        /// Returns an error response to the client from a callback. Code
        /// should exit after this call.
        /// </summary>
        /// <param name="ErrorMessage"></param>
        public void WriteErrorResponse(string errorMessage, string stackTrace)
        {
            CallbackException Error = new CallbackException();
            Error.message = errorMessage;
            Error.isCallbackError = true;
            Error.stackTrace = stackTrace;

            JSONSerializer Serializer = new JSONSerializer(SupportedJsonParserTypes.JavaScriptSerializer);
            string result = Serializer.Serialize(Error);

            if (!string.IsNullOrEmpty(JsonPMethod))
                result = JsonPMethod + "( " + result + " );";

            HttpResponse Response = HttpContext.Current.Response;
            Response.ContentType = ControlResources.STR_JsonContentType;

            Response.TrySkipIisCustomErrors = true;

            // override status code but only if it wasn't set already
            if (Response.StatusCode == 200)
                Response.StatusCode = 500;

            Response.Write(result);

            Response.End();
        }