Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Issues with Ajax calls

$
0
0

Hi.

I have a .net core api which works before locally. However, when deploying I get a "no Access-Control-Allow-Origin" header present issue.

I have Cors added in Startus.cs:

services.AddCors(options =>

{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});

If I call directly, I get a json result perfectly but Ajax gives me this error. On another pc, it gives ERR_CONNECTION_RESET.

The Controller method is:

[HttpPost]
public List<ProductViewModel> GetGenerics(string searchText)
{
List<ProductViewModel> lst = new List<ProductViewModel>();
ProModel prod = new ProViewModel() { Name = "test", IsOrder = true };
lst.Add(prod);
return lst;

}

Can anyone help here?

Thanks


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>