[Mono-aspnet-list] Consume ASP.NET webservice with AJAX

Baptiste Saleil baptiste.saleil at gmail.com
Tue Oct 30 18:48:58 UTC 2012

Hello there.

I'm developing a webservice for a personnal project.
Of course, I choose ASP.NET and Mono.

My webservice works perfectly excepted when I try to call it from ajax.
I accept cross-domain from the webservice :

Context.Response.AddHeader(“Access-Control-Allow-Origin”, “*”);

And I call my method like this :

var xdr = new XMLHttpRequest();
xdr.onload = function()
xdr.open("GET", "http://localhost:8080/WebService.asmx/debug");

This code work perfectly with my method "debug" which is defined like this :
 string debug()
return "someString";

My problem is that I have the error "Origin null is not allowed by
Access-Control-Allow-Origin." as soon as I try to call a method with args
like :

string test(string query)
return "someString";
What I'm doing wrong ?
Thanks :)
(And thanks for the work around ASP.NET and Mono)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20121030/cda1b3c2/attachment.html>

More information about the Mono-aspnet-list mailing list