Please enable Javascript for better experience...
Register Bundle, Route and Filters in Global.asax file in MVC
By Big | Jan 15, 2015 | In Tutorials | Total Views [ 14456 ]
Taged In
(5 Like)
Rate

In previous chapter you learnt how to add BundleConfig, FilterConfig and RouteConfig in your MVC project. In this part of tutorial you will see how to register them in Global.asax file.

Register configurations to Global.asax

Registering these configs to global file is very easy. Simply add below code to global.asax file and it will do rest of your job.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;

namespace DotNetConceptCreateMyFirstMVCProject
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }

    }
}

Till here you have registered Routing, Bundling and Filters to global.asax file. In next part of tutorial you will learn setting web.config file for MVC poject.

<< BundleConfig, FilterConfig and RouteConfig in MVC
Setting Web.Config file for MVC project >>

Share this

About the Author

Big
Rahul Jha (Big)
Founder, Developer dotnet-concept.com
Has working experience in different phases of Software Development Life Cycle (SDLC) in CMS, Gaming, Health Care and Financial Services domain using Agile pattern. Working experience in Design patterns, ASP.NET, MVC, Windows application, WCF, ADO.NET, SQL Server and Test Driven Development (TDD) environment with JQuery, JavaScript, N-Unit, Entity Frameworks, LINQ, Code Refactoring and Business Objects Models.

 
Please SignUp/Login to comment...

Or comment as anonymous...
* Name
* Email ID
Comment