how to clear CORS policy:Access-Control-Allow-Origin error [duplicate]

This question already has an answer here:

api reurn code:

    public HttpResponseMessage CheckCertificate(TCPCeritiNumber tCPCeritiNumber)

return Request.CreateResponse(HttpStatusCode.OK, tCP_Users);

angularjs controller

                    method: "post",
                    url: $rootScope.ServiceBaseUri + "api/NewUser/CheckCertificate",
                    data: JSON.stringify(tCPCeritiNumber),
                    contentType: "application/json",
                    datatype: "json"

                }).then(function (response) {

                    console.log(response, 'res');
                    data =;
                }, function (error, statusText) {

                    $scope.ssss = error.statusText;
                    console.log(error, 'can not get data.'); statusText

error msg:

Access to XMLHttpRequest at ‘http://localhost:51222/api/NewUser/CheckCertificate‘ from origin ‘http://localhost:58214‘ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Source: AngularJS

Related Post