sathishkumar
sathishkumar

Reputation: 1816

FilterConfig in visual studio 2015

I am trying to migrate my asp.net mvc web api project to visual studio 2015 preview version.

I am not finding a way to adopt the FilterConfig.cs code on visual studio 2015 since the 2015 version doesn't going to support global.asax, web.config.

So where i can put my filterconfig, areaconfig.

Upvotes: 2

Views: 858

Answers (1)

Ron DeFreitas
Ron DeFreitas

Reputation: 657

You need to register your filters in the StartUp class, inside the ConfigureServices method:

    public void ConfigureServices(IServiceCollection services)
    {
        // Add MVC services to the services container.
        services.AddMvc().Configure<MvcOptions>(options =>
        {
            options.Filters.Add(typeof (MyGlobalFilterAttribute));
        });
    }

Upvotes: 2

Related Questions