how to create Cross domain asp.net web service
Posted
by
Prithvi Raj Nandiwal
on Stack Overflow
See other posts from Stack Overflow
or by Prithvi Raj Nandiwal
Published on 2012-09-03T07:37:18Z
Indexed on
2012/09/03
9:38 UTC
Read the original article
Hit count: 277
i have create a web service. i want to access this web service using Ajax jqury. i am able to access on same domain. but i want to access thia web service to another domain.
Have any one idea. how to create cross domain web service in asp.net. any setting in web,config file so that i access it on another domain.
my webservice
[WebService(Namespace = "http://tempuri.org/")]
[System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service () {
}
[WebMethod]
public string SetName(string name) {
return "hello my dear friend " + name;
}
}
JavaScript
$.ajax({
type: "GET",
url:'http://192.168.1.119/Service/SetName.asmx?name=pr',
ContentType: "application/x-www-form-urlencoded",
cache: false,
dataType: "jsonp",
success: onSuccess
});
© Stack Overflow or respective owner