问题
My website uses MVC ASP.NET and Entity Framework user roles. The website also requires SSL for every page access by design. Thus, call the site example.com which can only be accessed as "https://example.com" or "https://www.example.com". Port 80 is configured to never respond. All pages work fine, except a main page link which can only be accessed when a user is already logged in. If the user is not logged in yet, moving the cursor over the link shows an https:... prefix is assumed to that link, but the [Authorize] attribute specified in the C# code at the top of the MVC controller action causes redirection to the login page without an https:// prefix. Rather than redirecting to https://example.com/..., redirection goes to example.com/... thereby leaving out the https prefix and causing a hang to the site that requires SSL for all pages.
来源:https://stackoverflow.com/questions/46500783/mvc-net-ssl-https-website-authorize-redirecting-using-http-not-https-to-lo