‘Hi
I am calling a web service from javascript/jquery as follows:
function Test(userid) {
alert(userid);
$.ajax({
type: "POST",
url: "testWebService.asmx/GetData",
data: "{ userid:'" + userid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("1")
var dATAS = (typeof (response.d)) == 'string' ? eval('(' + response.d + ')') : response.d;
alert("2")
},
failure: function (msg) {
}
});
}
the userid get alerted,
the webservice is tested and it is working, the other alerts doesnt show.
the output shows this:
A first chance exception of type ‘System.UnauthorizedAccessException’ occurred in mscorlib.dll
what Did I have wrong?
Edit: I copied the function to another existing webservice in the solution, it worked with no problem
Have you marked your web service class with ScriptService attribute? Failing to do so will result in an exception – but I am not certain if it would the one that you have got.