Generating a response of different types

So far, all the of action methods we have created returned simple response types, such as string or arrays, but the HTTP standard has no concept of method signature and return type. Instead, it defines the format of a valid HTTP response. This is how a simple HTTP response might look:

As you can see, the HTTP response includes Status Code, Headers, and Body. Each of these parts allows you to communicate pieces of information to the client, and ASP.NET Core provides the glue that converts the results of your action methods into those parts of the HTTP response, regardless of whether they are executed ...

Get Hands-On Full-Stack Web Development with ASP.NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.