We know how middleware components are added to the request pipeline, but how do we know which methods are available for use? We can find this answer by examining the
Configure() method we discussed in the previous lesson? The
Configure() method accepts an
IApplicationBuilder interface as a parameter:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
IApplicationBuilder interface provides the built-in middleware methods. These methods take the format
X describing the action performed by the method. There are five
UseX() methods highlighted in the example below. We’ll examine them in more detail a little later.
UseHttpsRedirection()redirects HTTP requests to the more secure HTTPS protocol
UseStaticFiles()allows static files, like CSS and images, to be served
UseRouting()allows route matching
UseAuthorization()ensures requests are authorized
UseEndpoints()adds endpoint execution to the middleware pipeline. It runs the code associated with the selected endpoint.
Note: There are several other built-in middleware components. Visit the
IApplicationBuilder documentation to see a complete list.
IApplicationBuilder documentation to see a complete list of the built-in middleware components available
via the IApplicationBuilder interface.
In this video, we go to the documentation to find the