Development of web-applications using ASP.Net MVC...

Developing web applications using ASP.Net MVC technology

Web applications developed using ASP.Net MVC technology, in contrast to Web Forms applications, do not consist of a set of derived classes from the Rade class (web forms) that include server controls, but from three types of classes:

Controllers (Controller) are classes that include methods (actions) that can be called by the user's request to the application;

views (View) - are set as a template, on the basis of which special classes are generated that describe the formation of HTML-responses to the user;

models classes of different types that contain data that are transferred from controllers to views for generating responses.

The peculiarity of MVC technology is that the user specifies in the URL not the path to the physical resource (for example, * .html or * .aspx), but the request to perform some action - public method of the controller class. For example: myprog.ru/Home/lndex/5 (no resource matches this URL). The order of processing such queries by MVC-application classes is shown in Fig. 4.23.

Order processing request for an MVC application

Fig. 4.23. Procedure for processing a request to an MVC application

The general logic of the ASP.Net MVC application is shown in Fig. 4.24.

Logic of working with ASP.Net MVC applications

Fig. 4.24. The Logic of the ASP.Net MCE Application Work

If you compare this schema with the logic of the ASP.Nel Web Forms application (see Figure 4.1), you can see that they are similar in many respects (these are the two ASP.Net technology frameworks). Applications created using ASP.Net Web Forms and MVC frameworks have common features: configuration; security (classes for working with accounts and roles); support for the state of the session and the application; caching. In principle, in one application, you can use the capabilities of both frameworks.

The difference between ASP.Net Web Forms and MVC between is only in the use of another MTTR handler. This handler creates the desired controller and calls the specified method.

In ASP.NET MVC, the developer has almost the same functionality for creating web applications as there are in Web Forms, but they are implemented using a different set of tools. The ASP.NET MVC ASP.NET framework uses a different template that is not based on web forms (Rade) and relies on a much thinner layer of abstraction. As a result, the developer does not have complex, built-in components for quickly creating a user interface in which elements can be supported.

In ASP.NET MVC, the developer writes code that is conceptually and physically closer to the basic Internet technologies; so it requires more programming, but at the same time gives it more control over the generated FITML code and the actual behavior of the application runtime. However, the developer does not have to write everything from scratch. He has at his disposal

• HTML helpers for automatically creating (simple) simple but functional visualization and editing tools for any simple and complex types;

• class attributes (additional metadata) for annotating data, for declarative assignment of required field content and how to present them;

• Binding tools for automatically converting data in the request with parameters of the controller action methods;

• Tools (also based on attributes) to check user input, both on the client side and on the server side.

Ошибка в функции вывода объектов.