Configuring the HTTP Request Pipeline
Explore how to configure the HTTP request pipeline in ASP.NET Core Razor Pages by using middleware delegates. Understand how to process HTTP requests and responses, implement common middleware methods like UseHttpsRedirection and MapRazorPages, and visualize the flow of requests in web applications.
Setting up the HTTP pipeline
After building the web application and its services, the next statements configure the HTTP pipeline, through which HTTP requests and responses flow in and out. The pipeline comprises a connected sequence of delegates that can perform processing and then decide to either return a response themselves or pass processing on to the next delegate in the pipeline. Responses that come back can also be manipulated.
Defining delegates
Delegates define a method signature that a delegate implementation can plug into. We might want to refer back to Implementing Interfaces and Inheriting Classes to refresh delegates’ understanding. The delegate for the HTTP request pipeline is simple, as shown in the following code:
We can see that the input parameter is an HttpContext. This provides access ...