I’m using asp.net web forms with Web Api.
I can make the call over http no problem but if I use https then I get “301 Moved permanently”
I’m also using authorization.
Users are authorized using https.
On the API Control I have:
[Authorize(Roles = "admin,masteradmin")]
[HttpGet]
public string Delete(Guid id)
{
return 'deleted'
}
my javascript:
function DeleteItem(ID) {
jQuery.support.cors = true;
$.ajax({
url: '/api/controlname/' + ID + '/Delete',
type: 'GET',
contentType: "application/json;charset=utf-8",
success: function (data) {
//alert('deleted');
},
error: function (x, y, z) {
alert(ID + '\n' + x + '\n' + y + '\n' + z);
}
});
}
again works fine over http but not with https.
Any suggestions?
Thank you
OK the problem, was that in global.asax I had a redirection to non https for non admin directories. I excluded the “api” directory from the redirection and now it all works as it should