Home > Mobile >  Check if secure connection (HTTPS) on AuthorizationFilter in .Net6.0
Check if secure connection (HTTPS) on AuthorizationFilter in .Net6.0

Time:10-01

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
  • Related