In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "ASP.NET MVC Foundation". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
MVC and ASP.NET MVC Basic Concepts
MVC stands for Model-View-Controller.
MVC divides an application into three components: Model\View\Controller.
MVC is not unique to ASP.NET, it is just a development concept. Struts2 in java is also an MVC model.
ASP.NET MVC has been released since version 1.0 in 2008. As of 2014, the latest version of ASP.NET MVC is 5.0.
ASP.NET MVC from version 1.0 onwards, has been open source (source address: aspnetwebstack.codeplex.com).
ASP.NET MVC official website address: www.asp.net/mvc
II. The interrelationship of the three components of MVC
Views and models can be invoked directly in the controller
The model can be invoked in the view.
Models cannot invoke views
Models can qualify data used in views, but models used in views should be provided by controllers
Controllers can be invoked in views (by submitting forms in views and clicking hyperlinks)
Third, the relationship between ASP.NET Webform model and ASP.NET MVC model
Both are development models based on ASP.NET Web framework. So ASP.NET some functions can be common to both.
The Webform programming model is typically an event driven web model, whereas MVC is not.
Webform URLs are file system based, while MVC is Action based.
Conventions in ASP.NET MVC
All controllers must be placed under the Controllers folder
All controller class names must end with Controller
All models should be placed in the Models directory
All view files should be placed in the Views directory.
All controller classes should inherit from the Controller class (essentially the Icontroller interface).
Public methods in controller classes are called Actions
If the view file is not found in the corresponding view directory, it looks for a view file with the same name in the Views\Shared directory.
In Action, return view() returns the view file with the same name as Action by default.
Default route (name Default) is registered in Global.asax global application class, default route specifies Controller default is Home,Action default is Index, parameter id is optional parameter. Therefore, if you do not enter controller in the URL address, you will access the Home controller by default; if you do not enter action, you will access the action.http://localhost:54321/Home/Index by default.
http://localhost:54321/Home/Index/5 Explanation: The value 5 is automatically mapped to the parameter named id in the action.
Http://localhost:54321/Home/Index/5? name=jack&age=20 Explanation: The parameters include id, name and age
other
In the view file, there is a property named Model, which refers to the model data passed from Action. To use the model data, we also need to set the model data type in the Inherits property of the directive in aspx view/model type in Razor view...
"ASP.NET MVC foundation what" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.