Skip to Content
Learn
Introduction To ASP.NET Middleware
Examining the IApplicationBuilder Interface

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 IApplicationBuilder interface.

Remember 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)

The IApplicationBuilder interface provides the built-in middleware methods. These methods take the format UseX() with 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.

  1. UseHttpsRedirection() redirects HTTP requests to the more secure HTTPS protocol
  2. UseStaticFiles() allows static files, like CSS and images, to be served
  3. UseRouting() allows route matching
  4. UseAuthorization() ensures requests are authorized
  5. 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.

Instructions

View the 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 UseWelcomePage() middleware.

Folder Icon

Sign up to start coding

Already have an account?