Today mainly to learn about the traditional web and MVC processing methods of similarities and differences.
Let's look at the Web processing method.
On the left is the client. On the right is the server software. The server will have aIISServer Software. Requests sent from the client (for example, www.TGB.cn/index.asp) areIISReceiveIt was handed to theFramework(integrated in IIS7), the frameworkaccording to the requested addressExecutionPage_Loada corresponding Page class object is created. That is, the serverIndexis compiled into a class.
This class of methods will prepare some of the output HTML or other content.
in other words, on the server sideit thinks he's asking for it.aspxbut actually the pagecalled by the correspondingProcessRequestMethodagain to callPage_LoadMethodthen read the database and other processing serviceswill besent back to the browser HTML+js +css, parsed by the browser intoHTMLpage.
The MVC handler
We enter an address on the client, note that there is no suffix by default. such as Www.TGB.cn/news/index
The focus is on the server side, and the IIS software receives the request and also gives it to the framework. Note that this is not the time to create a page class object.
Instead, you create an object of a class. Resolves the URL based on the routing configuration and creates an object of the news class and invokes the method of index (because the client's call is the class name news+ Method name index) while loading a view with the same name . This time the browser received is also html+js+css.
Short:
the MVC processing method request comes in no longer to create a Page object and then call ProcessRequest method is called again Page_Load . instead, create an object of the request class directly and call the object's index method.
Summary: The first time you learn MVC is not very understanding, by practicing in the project. Look back, slowly understand more. Learning is by practice, and learning is by repetition.
Traditional web and MVC processing methods