From the course: Blazor WebAssembly: Foundational Skills

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Cross-origin resource sharing (CORS)

Cross-origin resource sharing (CORS) - Blazor Tutorial

From the course: Blazor WebAssembly: Foundational Skills

Cross-origin resource sharing (CORS)

- [Instructor] One of the benefits of a hosted Blazor WebAssembly app is that both the server-side ASP.NET Core web and the client-side Blazor WebAssembly apps are hosted on the same host. And with some small configuration changes, it's easy to separate the projects so they run as two separate apps on different hosts. An ASP.NET Core web app can indicate what origins other than its own can make requests from a browser. This is known as cross-origin resource sharing or CORS. If a browser makes a request to the ASP.NET Core web app and it hasn't authorized the origin, an error message will be returned to the browser. CORS must be set up on the ASP.NET Core web app to authorize the origin so the browser can make a request and return a successful response. The server-side ASP.NET Core web and the client-side Blazor WebAssembly apps have been separated so they run independently. Looking in the Program.cs file for the ASP.NET…

Contents