articles

Home / DeveloperSection / Articles / ASP.NET MVC- Application Folders

ASP.NET MVC- Application Folders

Anupam Mishra6436 10-Mar-2016
ASP.NET MVC Folders:


ASP.NET MVC- Application Folders

The ASP.NET MVC framework is based on default naming convention. All Controllers are in the Controllers folder, All Views are in the Views folder, and All Models are in the Models folder. We have not additionally add the any bad naming convention in our MVC application. Everything is a much optimized and systematically defined. In every MVC application, we have finding a same folder.

This type of standard naming convention gives developer too much understandable and reduced code of line for development scenario.

In below is a brief explanation of each folder: 

The App_Data Folder:

The App_Data Folder are storing all file-based data in the prescribed format.

App_Data is also use for content stored as XML, typically where someone are not want to give hosting charges i.e. expensive for.

It is also called a local database. By default it is not accessible on web. We have also stored some other info such as contact (.csv file), SQLite file and many more. 

The App_Start Folder:


ASP.NET MVC- Application Folders

The App_Start folder has been introduced in ASP.NET MVC 4. In previous version we have configuration file is a Global.asax but ASP.NET MVC 4 introduced another folder is an App_Start. It contains various configurations files.

BundleConfig.cs:

 

BundleConfig are used to creating and registering bundles for CSS and JS files. By

Default, It will include various CSS and JS file, these are below:

ASP.NET MVC- Application Folders

FilterConfig.cs-

 

FilterConfig is used to create and register global filter action, filters error or filter etc.

By default it contains HandleErrorAttribute filter.

ASP.NET MVC- Application Folders

RouteConfig.cs-

 

RouteConfig is used to register various route patterns for our ASP.NET MVC

application. By default, Default Route is registered. We can modified as our

requirement.

ASP.NET MVC- Application Folders

For more details: :  Attribute Routing in ASP.NET MVC


WebApiConfig.cs- 
WebApiConfig is used for any Web API related configuration, including Web-API-
specific routes, Web API services, and other Web API settings.

ASP.NET MVC- Application Folders
The Content Folder:
ASP.NET MVC- Application Folders

This folder is used for static file such like: css, icon and Images. In Content, there is a one another folder i.e. Theme folder i.e. automatically created by Visual Studio IDE and It is stored a JQuery images and style etc.
In Content folder, we have a one standard css file i.e. site.css. Site.css is used to set style color & alignment of our application. We have changes according our requirement. 

The Controllers Folder:


ASP.NET MVC- Application Folders

  This folder contains the controller classes responsible for accept user request handling user input and their respective responses. In every ASP.NET MVC Controller naming convention is a first one is a name and last one the add “Controller”. For example, I want to create controller for “Home”. Then I have must give the name “HomeController

For more details: Working with Controller


The Models Folder:

ASP.NET MVC- Application Folders

This folder contains the all classes that representing application model.

For more details:    Working With Model


The Scripts Folder:
In Script folder is stored necessary JavaScript file such like: Ajax, and jQuery files. We have also additionally create our own JS file.
By default, Visual Studio are created a JS file "modernizr" ,It is used for supporting HTML5 and CSS3 features in the our application.


ASP.NET MVC- Application Folders


The Views Folder:


ASP.NET MVC- Application Folders

Views is the user interface and it will stored sep/arate folder for each controller.

For example, in above, we have various views such like: Account, Course, Home,

Shared etc.

The Shared folder is used to store views shared between controllers (master pages

and layout pages, _ViewStart pages).

For more details: Working With View

 

The Global.asax:

The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HttpModules. The Global.asax file resides in the root directory of an ASP.NET-based application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. 

Mostly used for application and session start/end events and for global error handling.

 For more details:  Introduction to Global.asax in ASP.NET 

The packages.config file:

The packages.config file is managed by the NuGet infrastructure. It is used to track installed packages with their respective versions. If we want to update our MVC 4 to MVC 5 then NuGet checked here of the previous version to replace by new one by creating their object. 

The Web.config file:

ASP.NET MVC configuration is stored in Web.config files i.e. a XML file.

These files can appear in many directories in an ASP.NET MVC application. They help to configure application behavior even before after deploying, based on the fact that we can edit them with any text editor.

The web.config file exists in the Views folders to prevent access to your views by any means other than your controller.

For more details: Web Config


 

 


Leave Comment

Comments

Liked By