I have a react jsx file that makes a call to a service as follows and the code in the service is as follows:
const copydata = (id, name) => {
return data_post('acmeAdmin/CopyData', { id: id, name: name })
}
Then I have a c# controller which has the following :
[HttpPost]
[Route("CopyData")]
public JsonResult CopyData([FromBody] CopyDataModel model)
{
var copydata = new helper.CopyData(model.id, model.name, out string error, out
string newid, _logger);
return new JsonResult(new { copydata = copydata, error = error, newid = newid });
}
public class CopyDataModel
{
public string id { get; set; }
public string name { get; set; }
}
The issue is that it all works when i run locally , but when i deploy to Azure and try to run it , it gives the error:
https://<my_react_app>/acmeAdmin/CopyData (Not Allowed)
or Bad Request?
Now this routine copies data between regions and i have setup CORAS in the deployed react app.
Any reason why these errors happen and how can i resolve ?