Anik Saha
Anik Saha

Reputation: 4494

How to check request for Mvc controller or Web api controller?

I integrate web api 2 request in mvc 5 project. How can I check request coming for mvc or web api controller?

Upvotes: 1

Views: 2086

Answers (1)

yazan_ati
yazan_ati

Reputation: 263

The most correct way would be to create a class that inherits ActionFilterAttribute and override OnActionExecuting method. This can then be registered in the GlobalFilters in Global.asax.cs

Of course, this will only intercept requests that actually have a route.

Upvotes: 1

Related Questions