What is the purpose of FilterConfig.cs , WebApiConfig.cs, BundleConfig.cs, RouteConfig.cs, Global.asax and WebConfig files in ASP.NET MVC ?
.
Kindly explain me the purpose of these files i am confused.
Thanks in advance.
Thanks in advance.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
geetha geethaPosted Nov 16, 2021, 12:05 PM
Nilesh JadavPosted Jul 11, 2015, 9:21 AM
These methods were in the Application_Start method in the global.asax file in older versions of the template. They were moved to separate class files in order to keep the global.asax file clean. The WebAPI one is there as a convienience; you can remove it (and the line that calls it in global.asax) if you aren't using WebAPI.
The web.config file in the views folder holds configuration settings for your view engine, and keeps the main web.config file clean. You should never need to do anything with the web.config in the Views folder.
https://msdn.microsoft.com/en-us/library/gg416513%28v=vs.98%29.aspxFilterconfig.cs:
Raja TPosted Jul 11, 2015, 3:52 AM
App_start folder has been introduced in Mvc4. It contains various configurations files like as :
for you application.All those settings are registered within App_Start method of Global.asax.cs file
BundleConfig.cs:
This is used to create and register bundles for CS and JS files.By default various bundles are added in this file including jQuery,jQueryUI,jQuery validation,Modernizr and Site Css..
FilterConfig.cs-
This is used to create and register global MVC filter error filter,action filter etc.By default it contains HandleErrorAttribute filter.
RouteConfig.cs-
This is used to register various route patterns for your Asp.Net MVC application. By default,one route is registered here named as Default Route.
WebApiConfig.cs-
This is used to register various WEB API routes like as Asp.Net MVC,as well sa set any addtionsl WEB ApI configurations settings.
Please refer below urlAuthConfi g.cs: Used to confi gure security settings, including sites for OAuth login.
BundleConfi g.cs: Used to register bundles used by the bundling and minifi cation system. Several bundles are added by default, including jQuery, jQueryUI, jQuery validation, Modernizr, and default CSS references.
FilterConfi g.cs: Unsurprisingly, this is used to register global MVC fi lters. The only fi lter registered by default is the HandleErrorAttribute, but this is a great place to put other fi lter registrations.
RouteConfi g.cs: Holds the granddaddy of the MVC confi g statements, Route confi guration.
WebApiConfi g.cs: Used to register Web API routes, as well as set any additional Web API confi guration settings.