this is my code for the web api
// POST api/Values
[HttpPost]
public async Task Post()
{
string user = new StreamReader(Request.Body).ReadToEnd();
var cmd = new SqlCommand(
@"insert into Users
select *
from OPENJSON(@user)
WITH( Username, Password, Email, Nickname, IsActive, Activation)");
cmd.Parameters.AddWithValue("user", user);
await SqlCommand.ExecuteNonQuery(cmd);
}
and this is my code for angular js
data = JSON.stringify({Username: user, Password: pwd, Nickname: user, IsActive: '1', Activation: '2u4bubdub32939342'});
$http.post('http://localhost:7792/api/values', data)
.success(function(data, status, headers, config) {
alert("success");
})
.error(function(data, status, headers, config) {
alert( "failure message: " + data + " " +status+ " " +headers+ " " +config);
});
} catch (e) { alert(e.message); }
when i run it, i get the failure message. i already have COR enabled in the web apo