From the course: Advanced ASP.NET Web API 2.2

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What is a message handler?

What is a message handler?

From the course: Advanced ASP.NET Web API 2.2

Start my 1-month free trial

What is a message handler?

- [Instructor] A message handler is a class that receives an HTTP request and returns an HTTP response. So, this is a definition, but let us try to understand it with our own words. Message handlers are nothing but a chain of classes that are part of a process of an HTTP request and response through a pipeline. Now, what does this mean? We send a request from the browser by clicking a button. So, we triggered an HTTP request, which is handled by the first handler. And if we have more than one handler, it will go up the chain to the second one, third one, et cetera, until we get the response that we want. So the first handler receives an HTTP request, does some processing and gives the request to the next handler and so on. At some point a response is created and goes back up the chain. So we that we have a pattern in here and this pattern is called a delegating handler pattern. But why we want to use a message handler?…

Contents