Listening on HTTP and HTTPS? - C#/ASP.NET/Kestrel

Viewed 89

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

IApplicationBuilder does not contain a definition for UseHttpRedirection" 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.

What am I doing wrong?

        // Always require HTTPS
        app.UseHttpsRedirection();
        //Use when requiring port 80
        app.UseWhen(context => context.Request.Port == 80, httpApp =>
        {
            httpApp.UseHttpRedirection();
        });
1 Answers
Related