I\'m using this code to try and redirect the user from http to https in an ASP.NET Core 3.1 application:
class Startup