Warning:
This question is NOT about How to post TO a Web Api, is How to post FROM Web Api.
Scenario:
My question is related to the comments of the answer of Darin Dimitrov in: How to Redirect in ASPNET Web API
and is seems to be a duplicated for: Response.Redirect which POSTs data to another URL in ASP.NET but take in consideration that the question is already old (2008) and I'm looking for answer that maybe WebApi is up to date.
Using Visual Studio 2012 Web Api 2.1
I've get from data in my application (is a web api) trough a POST method in a controller. So far so good. Now I want to post this data (with some changes) to an external site that accepts my data (this is validated and works).
For this process I've tried two methods:
Make a string with a basic form that submit with a "onload" event with javascript.
From (Response.Redirect which POSTs data to another URL in ASP.NET). This is working, and this is how I'm using it, but maybe can be replaced with some better approach.With an
HTTPClient
usingclient.PostAsync
. I could also work with this, but I don't want show the response to the user, I want to redirect him. Maybe can be this adapted to make a redirect?
Question:
How do I redirect sending Post variables without using the "onload" workaround or adapting the "HttpClient" to make a post-redirection without waiting for response ?
Consideration: I don't post any code because implementations of my two options are already easy and I don't have any trouble with them.