aspdotnet_static_middleware.md - brainchildservices/curriculum GitHub Wiki

SLIDE-1

Static middleware

SLIDE-2

  • In ASP.NET Core, MiddlewareS are C# classes that can handle an HTTP request or response. Middleware can either:

    • Handle an incoming HTTP request by generating an HTTP response.
    • Process an incoming HTTP request, modify it, and pass it on to another piece of middleware.
    • Process an outgoing HTTP response, modify it, and pass it on to either another piece of middleware, or the ASP.NET Core web server.

image

SLIDE-3

  • app.UseStaticFiles(); is calling UseStaticFiles middleware.

    • This middleware help to access all static files needed for an aspdotnet core application.
    • all middlewares are included in Configure function of Startup.cs in aspdotnet core application.
    • Below image show the site.css file in css(see the URL) for local aspdotnet core application. image
  • Without UseStaticFiles middleware , static files would not be accessible in aspdotnet core application.