title: How to perform an HTTP POST and redirect the user to an external site?
body: <p>So as the title suggest how does one perform an HTTP POST to an external website while also redirecting the user there? I am looking for something similar to this: </p>
  
  <pre><code>Redirect("MyWebsite.com", HttpAction.POST, new RedirectData(new { item = "itemValue"}));
  </code></pre>
  
  <p>It has to be done in ASP.NET mvc.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This behaviour is necessary to implement authentication on an external website. The algorithm for the authentication:</p>
  
  <ol>
  <li>User navigates to the webpage that requires him to be identified.</li>
  <li>The webpage calls the web service of the authentication website and initializes authentication.</li>
  <li>Initialization returns GUID that has to be posted to the given URL (let's say it is "MyWebsite.com").</li>
  <li>The user is supposed to be redirected to the URL that data was posted to.</li>
  </ol>
  
  <p>So far I've managed to come up with this:</p>
  
  <pre><code>string url = "MyWebsite.com";
  NameValueCollection formData = new NameValueCollection();
  formData["ticket"] = Ticket.ticket;
  WebClient webClient = new WebClient();
  byte[] responseBytes = webClient.UploadValues(url, "POST", formData);
  
  Response.BinaryWrite(responseBytes);
  Response.Redirect("MyWebsite.com", true);
  </code></pre>
  
  <p>The response I get is the HTML of the website I am supposed to be redirected to and the question is - what now? How do I tell the browser to display HTML that I got via the response? If I simply redirect to "MyWebSite.com" it would execute a GET action, which is not what I am looking for. Doing binary write of the response accomplishes nothing - it just writes the response of the POST action to the action I am currently executing - there is no redirect to "MyWebSite.com". </p>