Im getting Error as:
Failed to load http://localhost:10948/Api/Home/PostData/[object%20Object]: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:57580' is therefore not allowed access. The response had HTTP status code 404.
Even i have Access-controll Orion File in my WebAPi(Global.asax.cs)File
protected void Application_BeginRequest()
{
string[] allowedOrigin = new string[] { "http://localhost:57580", "http://localhost:11518" };
var origin = HttpContext.Current.Request.Headers["Origin"];
if (origin != null && allowedOrigin.Contains(origin))
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", origin);
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,POST");
}
Angular.js
$scope.SubmitForm = function (isValied) {
var EmployeeDetails = {
'Empname': $scope.Emp.EmpName
}
if (isValied) {
EmployeeFactoryService.SaveEmployeee(EmployeeDetails).then(function ()
})
}
}
Factory.Js
EmployeeFactoryServices.SaveEmployeee = function (Employee) {
return $http({
url: 'http://localhost:10948/Api/Home/PostData/'+ Employee,
method: 'POST',
ContentType: 'application/x-www-form-urlencoded', })