maoyuan121 / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

jQuery + ASP.net ScriptService #174

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
using jQuery to via $.ajax to call a WebService method, which is decorated 
with the following attributes;

.cs
----

    [WebMethod(EnableSession = true)]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public static string HelloWorld()
    {
        throw new Exception("Hello World");
    }

.js
----
    $.ajax({
        type: "POST",
        url: "Default.aspx/HelloWorld",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json"
    });

ELMAH does not log this exception.

Original issue reported on code.google.com by draxi...@gmail.com on 7 Jun 2010 at 5:01

GoogleCodeExporter commented 9 years ago
Is there any changes on this issue?  Any configuration I can change to get it 
to log jquery ajax requests to page methods?  I'm looking for an alternative to 
Application_Error that actually works with jquery ajax.

Original comment by one...@gmail.com on 11 May 2011 at 7:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi, I'm having the same problem. I'm not using a .ASMX file has a web service. 
I'm using a .ASPX file but it's the same thing. I'm also returning JSON.

Any ideias on how to solve this?

Original comment by xjpmauri...@gmail.com on 12 Mar 2012 at 4:17

GoogleCodeExporter commented 9 years ago
Hi, I am having the same problem too. :(

Original comment by PhucTran...@gmail.com on 22 Jun 2012 at 1:14

GoogleCodeExporter commented 9 years ago
Hi again,

I found the solutions.

To get it work, we need to use ErrorLog as below.

ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Error(exception))

It works for me.

Cheers,

Original comment by PhucTran...@gmail.com on 22 Jun 2012 at 1:34