When writting an AuthorizationFilter in .Net Framework we could use:
AuthorizationContext.HttpContext.Request.IsSecureConnection
This is not available anymore on .Net6.0, in it's equivalent AuthorizationFilterContext
.
How can I check if the request is using HTTPS protocol (check if the connection "is secure"), inside an AuthorizationFilter in .Net6.0 ?
Thanks in advance for any help
CodePudding user response:
You can use HttpRequest.IsHttps Property:
AuthorizationFilterContext.HttpContext.Request.IsHttps