I am going to discuss four interrelated terms and the code that they represent in this article. These are terms that sometimes get used interchangeably or applied somewhat haphazardly, describing the same block of code. But these terms have specific meanings, intentions, and uses inside your application. These uses are similar across application types and languages, but I am focusing on C# .Net Core Web Applications. Misapplying them is not inherently wrong, but it indicates that you possibly do not understand what the interaction between these terms is and how to use them in your application.
There are several ways to separate these terms, but in general, Actions and Routes are interface elements that exist purely as the external web interface to your application. Internal to your application, these are not code but attributes and configuration of objects. These provide the communication interface that an external web application uses to communicate with your application.
Handlers are a less defined area; this is because there is nothing that is directly called a “handler” in .Net Core. There are EventHandlers, Callbacks, Delegates, Events, and their Handling. But handler is used as shorthand for this whole group of objects, methods, events, properties, and variables. In general, if you hear or read handler, be on alert because what you are seeing is that someone does not quite know what they are using but know it is about handling something. Usually, this something ends up being either a delegate passed in as a callback or a method used as an event handler. Again, a delegate, but from your code to the system rather than from external application to your code.
Methods are the best defined and best understood. These are the building blocks of a C# application — you write your code into these. If you do not know what a method is, why are you reading this article? But seriously, all the other terms come down to running one or more methods in the end. These methods may be called handlers, actions, callbacks, endpoints, or routes. But, in the end, you wrote them as methods.
So, that was a brief overview. Now I will take a bit of a deeper dive into each term and how to use it.