MVC5 application Directory

Source: Internet
Author: User
Tags configuration settings hosting

Before always use Youdao cloud to make study notes, this time slowly try to use blog Park to take notes, with MVC5 developed a project, recently suddenly MVC5 frame particularly confused. Let's review it again.

The first MVC 5 application project structure, then we will explain in turn their respective applications. (Excerpt from: http://www.jb51.net/article/50839.htm)

App_Data: This folder is primarily a local store that contains applications, which typically contain data stores in the form of files such as Microsoft SQL Server database files, XML files, and so on.

App_start: This folder contains configuration logic files for the application, including BundleConfig.cs, FilterConfig.cs, RouteConfig.cs, Startup.Auth.cs

BundleConfig.cs: Register the bundled CSS and JS files that are used.

FilterConfig.cs: Register External/Global filters, which can be applied to each action and controller.

RouteConfig.cs: Configures the system routing path for an MVC application.

Startup.Auth.cs: Configuring security information for MVC applications, including authentication and authorization configurations, and third-party authentication Provider

Content: This folder is recommended for storing static content files like CSS and (picture) Images

Controllers: As the name implies, this folder is used to store all controllers and the controller must end with "controller".

Fonts: This folder is used to store font files that may be used by MVC applications

Models: This folder is used to store application entity model classes, and entity classes can define objects and application logic.

Scripts: This folder stores ASP. NET Ajax Foundation files and jquery by default. It is used primarily to store script (JS) files supported by the application.

Views: This folder is primarily used to store layout files (. master) used by MVC applications, view files (. aspx), and view user control files (. ascx)

Attentive readers will also notice Global.asax, Startup.cs (new additions to the MVC 5 application) and Web. config.

Gobal.asax:

(from MSDN) The Global.asax is primarily a global settings file for a Web application that contains code that responds to application-level and session-level events that are raised by an ASP. NET or HTTP module. The Global.asax file resides in the root directory of your ASP. At run time, the Global.asax is parsed and compiled into a dynamically generated. NET Framework class that derives from the HttpApplication base class. Configure ASP. NET to automatically deny any direct URL requests to the Global.asax file; external users cannot download or view the code in it. The Global.asax file is optional. You should only create an application event or session event if you want to handle it.

Web. config:

((excerpt from MSDN) the Web. config file is an XML text file that is used to store configuration information for Asp.netweb applications (such as the most commonly used settings for Asp.netweb application authentication), which can appear in each directory of the application. When you pass. NET creates a new Web application, by default, a default Web. config file is automatically created in the root directory, including the default configuration settings, and all subdirectories inherit its configuration settings. If you want to modify the configuration settings for subdirectories, you can create a new Web. config file under that subdirectory. It can provide configuration information other than the configuration information inherited from the parent directory, or you can override or modify the settings defined in the parent directory. Modifications to the Web. config file at run time do not need to restart the service to take effect (note: section exceptions). Of course, the Web. config file can be extended. You can customize the new configuration parameters and write configuration section handlers to process them.

The following Startup.cs files are highlighted:

Startup.cs:

This file is primarily provided to Owin (Open Web Interface for. NET) applications, the purpose of Owin is to understand the coupling server application. For example, in the case of ASP. NET identity using Owin security, SignalR self hosting use Owin hosting, and so on, our MVC application is used to Owin, so, All of them will use the startup class defined by Startup.cs as appropriate. The application of Owin is not detailed here, the reference to own is mainly to illustrate the use of Startup.cs files.

MVC5 application Directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.