Configuration logic moved to App_Start in MVC 4

New features are nice, but the additional logic for features that are configured via code was really starting to clutter up the Global.asax -> Application_Start method. These configurations have been moved to static classes in the App_Start directory.

  1. AuthConfig.cs: Used to confi gure security settings, including sites for OAuth login.
  2. BundleConfig.cs: Used to register bundles used by the bundling and minification system. Several bundles are added by default, including jQuery, jQueryUI, jQuery validation, Modernizr, and default CSS references.
  3. FilterConfig.cs: Unsurprisingly, this is used to register global MVC filters. The only filter registered by default is the HandleErrorAttribute, but this is a great place to put other filter registrations.
  4. RouteConfi g.cs: Holds the granddaddy of the MVC confi g statements, Route configuration.
  5. WebApiConfi g.cs: Used to register Web API routes, as well as set any additional Web API configuration settings.

Ebook Download
View all
Learn
View all