I am calling web method using ajax call.Here is the example call.
    [WebMethod(true)]
    public static string Save(string customParams)
    {
        throw new ApplicationException("Example Exception");
     }
    $.ajax({
        url: url,
        type: "POST",
        data: data,
        contentType:"application/json; charset=utf-8",
        dataType: props.dataType ? props.dataType : "text",
        error: function (xhr, errorType, ex) {
            debugger;
            err(ex);
        }
    })
If that method throws an exception I only get 500 internal server error.Stacktrace is empty and I can't get the inner exception message.I decorated webmethod with try catch blocks and return HttpException and set text of it but it didn't work.
    try
    {
    throw new ApplicationException("Example Exception");
    }
    catch (Exception e)
    {
      throw new HttpException(500,e.Message,e);
    }
I also tried this solution again with no luck.
        catch (Exception e)
        {
            HttpContext.Current.Response.Write(e.Message.ToJsonString());
            HttpContext.Current.Response.StatusCode=500;
        }
By the way I also experimented that uncaught exception when request is ajax request can't be caught by Global.asax's Application_Error.Here is the issue. I switched custom error off.Now it's displaying error but still not a intented solution.
Any solution ? Thanks in advance.
