ASP.NET Core redirect http to https

前端 未结 6 1617
陌清茗
陌清茗 2021-01-01 17:11

I have created a redirect rules in my web.config to redirect my website from http to https. The issue i have is that every single link on the website is now https. I have a

6条回答
  •  忘掉有多难
    2021-01-01 17:38

    asp.net core < 2 just put this code into your startup.cs

            // IHostingEnvironment (stored in _env) is injected into the Startup class.
            if (!_hostingEnvironment.IsDevelopment())
            {
                services.Configure(options =>
                {
                    options.Filters.Add(new RequireHttpsAttribute());
                });
            }
    

提交回复
热议问题