Do I need a Global.asax.cs file at all if I’m using an OWIN Startup.cs class and move all configuration there?

Let’s say for example in a brand new ASP.NET MVC 5 application made from the MVC with Individual Accounts template, if I delete the Global.asax.cs class and move it’s configuration code to Startup.cs Configuration() method as follow, what are the downsides?

public partial class Startup
{
     public void Configuration(IAppBuilder app)
     {
        AreaRegistration.RegisterAllAreas();
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);

        ConfigureAuth(app);
    }
}

The upsides for me is that when upgrading ASP.NET 4 applications to ASP.NET 5 and using pieces that now must be configured in the Startup.cs class, I’m not doing dependency injection and other configuration in two different classes that seem related to starting up, and configuration.

3 Answers
3

Leave a Comment