Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the MVC5 application projects?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "what are the MVC5 application projects", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the MVC5 application projects.

From the figure above, we can clearly understand the project structure of the MVC 5 application, and let's explain their respective applications in turn.

App_Data: this folder mainly contains the local storage of the application, and it usually contains the data store in the form of files (such as Microsoft SQL Server database files, XML files, etc.).

App_Start: this folder contains the 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 used.

FilterConfig.cs: register external / global filters that can be applied to every Action and Controller.

RouteConfig.cs: configure the system routing path for the MVC application.

Startup.Auth.cs: security information for configuring 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 stores font files that may be used by MVC applications

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

Scripts: this folder stores ASP.NET Ajax Foundation files and Jquery by default. It is mainly used to store JS files supported by the application.

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

Careful readers will also notice Global.asax, Startup.cs (new to MVC 5 applications), and Web.config.

Gobal.asax:

(excerpt from MSDN) the Global.asax here is primarily the global settings file for the web application, which contains code that responds to application-level and session-level events raised by ASP.NET or HTTP modules. The Global.asax file resides in the root directory of the ASP.NET application. At run time, the Global.asax is parsed and compiled into a dynamically generated .NET Framework class that is derived from the HttpApplication base class. Configure ASP.NET to automatically reject 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 create it only if you want to handle application or session events.

Web.config:

(excerpted from MSDN) the Web.config file is an XML text file that stores configuration information for ASP.NETWeb applications (such as the most common way to set authentication for ASP.NETWeb applications) and can appear in every directory of the application. When you create a new Web application through .NET, a default Web.config file is automatically created in the root directory by default, including the default configuration settings, and all subdirectories inherit its configuration settings. If you want to modify the configuration settings of the subdirectory, you can create a new Web.config file in that subdirectory. It can provide configuration information in addition to the configuration information inherited from the parent directory, or it can override or modify settings defined in the parent directory.

Changes to the Web.config file at run time do not need to restart the service to take effect (note: section exception). Of course, Web.config files can be extended. You can customize the new configuration parameters and write configuration section handlers to handle them.

Focus on the following Startup.cs files:

Startup.cs:

This file is mainly provided for use by OWIN (Open Web Interface for. Net) applications, and OWIN is designed to decouple server applications. For example, when ASP.NET Identity uses OWIN security and SignalR self hosting uses OWIN hosting, our MVC applications all use OWIN, so they all use Startup class defined by startup.cs accordingly. The application of OWIN is not detailed here, but OWN is mainly mentioned here to illustrate the use of Startup.cs files.

At this point, I believe you have a deeper understanding of "what are the MVC5 application projects?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report