.NET MVC

Karim Samir
SimplifyInterview
Published in
2 min readJun 4, 2024

ASP.NET MVC Folder Structure

App_Start folder contain the class files which are needed to be executed at the time the application starts.

  • FIlterConfig.cs — This is used to register global MVC filters like error filters, actions filters 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.

App_Data folder can contain application data files like LocalDB, .mdf files, XML files(Ex: For HTML Labels), and other data related files. IIS will never serve files from App_Data folder.

Content folder contains static files like CSS files, images, and icons files. MVC 5 application includes bootstrap.css, bootstrap.min.css, and Site.css by default.

Global.asax file allows you to write code that runs in response to application-level events, such as Application_BeginRequest, application_start, application_error, session_start, session_end, etc.

  • Application_Init: Fired when an application initializes or is first called. It is invoked for all HttpApplication object instances.
  • Application_Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.
  • Application_Error: Fired when an unhandled exception is encountered within the application.
  • Application_Start: Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances.
  • Application_End: Fired when the last instance of an HttpApplication class is destroyed. It is fired only once during an application’s lifetime.
  • Application_BeginRequest: Fired when an application request is received. It is the first event fired for a request, which is often a page request (URL) that a user enters.
  • Application_EndRequest: The last event fired for an application request.

Web.config file contains application-level configurations. Like Databse connection, SMPT Email Config.

--

--