Other security topics
As we mentioned at the beginning of this chapter, security is a very broad topic. In this section, we will briefly introduce some other security topics.
Always use Hypertext Transfer Protocol Secure (HTTPS)
HTTPS is a protocol that provides secure communication between a client and a server. It is a combination of the HTTP and Secure Sockets Layer/Transport Layer Security (SSL/TLS) protocols. HTTPS is used to encrypt communication between the client and the server, ensuring that sensitive data transmitted over the internet is secure and cannot be intercepted by unauthorized third parties. Google Chrome and other modern browsers will display a warning if you try to access a website that does not use HTTPS. Therefore, it is very important to use HTTPS for all your web applications.
The default ASP.NET Core web API template can use both HTTP and HTTPS. It is recommended to use HTTPS only. So, we need to configure the project to redirect all HTTP requests...