Migrating an HTTP handler to middleware

In this recipe, we will learn how to transform an ASP.NET HTTP handler to ASP.NET Core middleware.

Before anything, let's recap what an HTTP handler is. An HTTP handler handles an incoming request from the ASP.NET/IIS pipeline and generates a response for a given extension file (.aspx, .html, .jpg, and so on.) For ASP.NET MVC, we used a specific handler named MVCHandler, which ensures that an action method exists in a controller for the specified route in the request URL.

Get ASP.NET Core MVC 2.0 Cookbook 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.