title: Listening on HTTP and HTTPS? - C#/ASP.NET/Kestrel
body: <p>Question - I need my app to force HTTPS connection (443) but if a connection request comes in on 80, to take it and accept it, though on my below code I am getting</p>
  <blockquote>
  <p>IApplicationBuilder does not contain a definition for UseHttpRedirection&quot; and no accessible extension method 'UseHttpRedirection' accepting first argument of type IA ApplicationBuilder could be found, and error HttpRequest does not contain a definition for port.</p>
  </blockquote>
  <p>What am I doing wrong?</p>
  <pre><code>        // Always require HTTPS
          app.UseHttpsRedirection();
          //Use when requiring port 80
          app.UseWhen(context =&gt; context.Request.Port == 80, httpApp =&gt;
          {
              httpApp.UseHttpRedirection();
          });
  </code></pre>