3

MVC and WebAPI are being combined for ASP.NET 5 / MVC 6, however I still want to be able to differentiate between the two.

Previously, different behaviours could be implemented in the form of global filters, on both MVC and Web API.

Now the two are combined in MVC 6, how could I cause a global filter to only apply its behaviour for Web API actions?

1 Answer 1

1

You can separate the controller types by namespace or assembly. Create a custom filter provider that extends the DefaultFilterProvider class. The provider would check the controller namespace and return the appropriate action filters.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.