From the course: Advanced Web APIs with ASP.NET Core in .NET 6
Unlock the full course today
Join today to access over 24,600 courses taught by industry experts.
Enforcing HTTPS - C# Tutorial
From the course: Advanced Web APIs with ASP.NET Core in .NET 6
Enforcing HTTPS
- [Instructor] When we set up our API, there has been this checkbox Configure for HTTPS, and that was activated by default. When using the .NET CLI, the behavior that comes with Configure for HTTPS is on by default as well. But what exactly does that mean? Let's look at the project in the properties/launchsettings.json file, we see that there are two application URLs. One HTTPS URL, in my case it's using port 7233. And if you set up a new project you will, with very high probability, have different port. But there will also be an HTTP URL with another port that usually is just the HTTPS port -2000. And the same is the case here. So we have local host 5233 for HTTP and then we also have the HTTPS URL. In program CS what the checkbox actually does is the call to app.useHTTPSredirection() when the HDP URL. So technically when the web server receives a request on the HTTP port, then it redirects the same URL, but…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Introduction31s
-
(Locked)
Enforcing HTTPS5m 16s
-
(Locked)
Consuming the API with JavaScript4m 44s
-
(Locked)
Cross-origin resource sharing (CORS)4m 12s
-
(Locked)
Enabling CORS4m 44s
-
(Locked)
Adding ASP.NET Core Identity6m 56s
-
(Locked)
Adding token-based authentication8m 51s
-
(Locked)
OAuth and OpenID Connect4m 19s
-
(Locked)
Securing the API with IdentityServer6m 10s
-
(Locked)
Consuming the protected API6m 40s
-
(Locked)
-