This project is read-only.

Project Description:

A small library for ASP.NET MVC Framework, that can be used as a facility for registering global filters in ASP.NET MVC 2 and add support of criteria for global filters in ASP.NET MVC 3.
NOTE: Assemblies of FluentFilters for ASP.NET MVC 2 and ASP.NET MVC 3 are different in use. Please see specific sections of the documentation.

If you are looking for ASP.NET Core version, you can find it on GitHub page


For use FluentFilters with ASP.NET MVC 3, you must take several steps:

  1. Download the latest release
  2. Unzip the zip file and add a reference to bin\mvc3\FluentFilters.dll in your MVC project
  3. Instead steps 1-2 you can use NuGet. Right click on References and click Add Library Package Reference. Click Online on the left side, and in the Search box at upper right type in "FluentFilters". Click Install. Alternatively, open the Package Manager Console and type "Install-Package FluentFilters"
  4. Register FluentFiltersCollection provider in Global.asax.cs:

    protected void Application_Start()
        FilterProviders.Providers.Add(FluentFiltersBuider.Filters); // Register FluentFilter provider
        RegisterGlobalFilters(GlobalFilters.Filters, FluentFiltersBuider.Filters); // Register filters
  5. Register Global Filters for FluentFiltersCollection by specified criteria:

    public static void RegisterGlobalFilters(GlobalFilterCollection filters, FluentFilterCollection fluentFilters)
        filters.Add(new HandleErrorAttribute());
        fluentFilters.Add<TestActionFilterAttribute>(a => {
            a.Require(new ControllerFilterCriteria("Admin")).Or(new ControllerFilterCriteria("Manager"));
            a.Exclude(new ControllerFilterCriteria("Manager")).And(new ActionFilterCriteria("Index"));
  6. Learn how it works
  7. Review the project documentation if have any questions


It is similar to Global Filter in ASP.NET MVC 3, but with different implementation and features.

How to start?

  1. Download the latest release
  2. Unzip the zip file and add a reference to bin\mvc2\FluentFilters.dll in your MVC project
  3. Learn how it works
  4. Review the project documentation if have any questions


Working application examples you can find in src\MVC2\Samples folder of source code.

// Global.asax.cs
using System.Web.Mvc;
using System.Web.Routing;
using FluentFilters;
using FluentFilters.Criteria;
using Website.Core.Filters;
using Website.Core.Filters.Criteria;

namespace Website
public class MvcApplication : System.Web.HttpApplication
public static void RegisterRoutes(RouteCollection routes)

"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults

private static void RegisterFluentFilters()
// Register global filters
FluentFiltersBuilder.Current.Add<BrowserDetectionFilter>(c => {
c.Exclude(new ControllerFilterCriteria("Account"));

FluentFiltersBuilder.Current.Add<AuthenticationFilter>(c => {
c.Require(new AuthenticationFilterCriteria("authentication", "login", new[] { "Administrator" }))
.And(new AreaFilterCriteria("administrator"));
c.Exclude(new ActionFilterCriteria("logout"));

private static void RegisterControllerFactory()
// Set controller factory
ControllerBuilder.Current.SetControllerFactory(new FluentFiltersControllerFactory());

protected void Application_Start()




FluentFilters Articles

§ Fluent Filters – глобальные фильтры действий для ASP.NET MVC 2
§ Fluent Filters - Global Action Filters for ASP.NET MVC 2
FluentFilters для ASP.NET MVC 3
§ FluentFilters for ASP.NET MVC 3 - Register global filters by specified conditions

Last edited May 26, 2016 at 5:45 PM by banguit, version 66