I have a WebAPI request made from my UI to WebAPI. This needs to return an HttpResponseMessage with a status code of HttpStatusCode.Moved, so that browser is redirected to another URL. My problem is that this target URL has to be a POST request, with a POST parameter. How do i accomplish this? So far i have tried:
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Moved);
var json = new Dictionary<string, string>() { { "postparameter", postparameter } };
response.Content = new StringContent(json.ToString());
response.Headers.Location = new Uri(targetURL);
return response;