Traditional web and MVC processing methods

Source: Internet
Author: User

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

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.