I have a WebApi controller that after I invoke it I want it to redirect me to another site
Here is my c# code
public async Task<HttpResponseMessage> Login(LoginParameters parameters, [FromUri]string returnUrl)
{
//same validations
var response = Request.CreateResponse(HttpStatusCode.Moved);
response.Headers.Location = new Uri("Http://www.google.com");
return response;
}
My javascript code goes like this
'user strict'
var login = function ($scope, $http) {
var parameters = {
userName: userName,
password: password
};
var url = '/api/user/Login';
$http.post(url, parameters);
.then(function(response){
/*some random code that i will remove */
});
};
login.$inject = ['$scope', '$http'];
module.exports = login;
Looking at the chrome console i realise that the http POST call returns httpstatus = 302. Then i see 2 more request to requests to google.com, but my page is not redirected. So what am I doing wrong?
Thanks in advance