title: How to redirect to URL (with custom headers) from C# Controller
body: <p>I need to redirect the user's browser to a new URL from my .NET Core C# controller action, and add my own custom request header with a JWT token.</p>
  <p>Is this possible? What's the best way to do this?</p>
  <p>Other sites have suggested <code>Response.Redirect(&quot;http://www.whatever.com&quot;)</code> and <code>Server.Transfer(&quot;http://www.whatever.com&quot;)</code>. The former redirects, but I can't get the headers to work. The latter I couldn't get to work at all. <code>Server</code> requires <code>System.Web.HttpContext</code>, which has been removed from .NET Core.</p>
  <pre><code>[HttpPost]
  public void RedirectWithHeaders(string token)
  {
      var payload = decodeJwtFromString(token);
      var jwt = makeNewJwt(payload);
  
      // Now go to the URL with an authorization header
  }
  </code></pre>
  <p>This controller action needs to accept a posted string (that part's working fine) and then redirect or otherwise navigate to a new page with an added authorization header (made out of the dissected posted string).</p>