Please enable Javascript for better experience...
Register Bundle, Route and Filters in Global.asax file in MVC
By Rahul Kumar Jha | Jan 15, 2015 | In Tutorials | Total Views [ 23992 ]
Taged In
(7 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

Rahul Kumar Jha
Rahul Kumar Jha
Founder, Developer dotnet-concept.com

Public profile: user/profile/99900001


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, ANGULAR, ANGULAR JS, 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.

User's Comments


 
Please SignUp/Login to comment...

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