¿Cómo agregar Access-Control-Allow-Origin?
Recibo el siguiente error cuando llamo a mi método de servicio web.
Origin http://localhost:4165 is not allowed by Access-Control-Allow-Origin.
Al referirme a la red estoy obteniendo solución como agregarAccess-Control-Allow-Origin
No sé dónde añadir esto. Mi guión es:
$(document).ready(function () {
$.ajax({
type: "Post", dataType: "json", contentType: "application/json; charset=utf-8",
url: "http://localhost:63384/ListWebService.asmx/HelloWorld", success: function (data) { alert(data.d); }, error: function (request, status, error) {
alert(request.responseText);
}
});
});
Y mi método de servicio web es:
[WebMethod]
public string HelloWorld()
{
return "Hello User";
}