Does MessageHandler in WebAPI is the same as HttpHandler in ASP.NET?

I am using WebAPI to develop a REST based communication model for my clients.

To intercept the incoming request and log them, I use a class that is derived from MessageHandler and register it in the WebAPIConfig.

Note: I never happened to work with legacy ASP.NET Web applications.

When I attended an interview yesterday, the interviewer asked about HttpHandlers in ASP.NET.

Is the HttpHandler so called MessageHandler in WebAPI or both are different ?

Upvotes: 1

Views: 2347

Answers (1)

Marcel N.
Marcel N.

Reputation: 13976

You can say that MesssageHandler is to Web API what HttpModule is to pre-vNext ASP.NET.

An HttpHandler in ASP.NET has a role more similar to an ApiController in Web API request pipeline: it is delegated requests and returns something in response.

Upvotes: 3

Related Questions