Summarization of three kinds of asp.net methods

Source: Internet
Author: User
asp.net (1) Server.Transfer method:
Server.Transfer ("m2.aspx");//page turn (performed on server).
The server stops parsing this page, saves the data before it is turned on, and then shifts the page to m2.aspx,
and return the data before the turn to the browser, plus the m2.aspx page results.


(2) Server.Execute Method:
Server.Execute ("m2.aspx");
After the server saves the data before the page is turned, the page shifts to m2.aspx execution,
Return to this page to continue. The three results are merged and returned to the browser.

All of these are server-side page turns so the browser does not appear page change records (the displayed address does not change).
Therefore, if the user refreshes this page, there may be some other unexpected situation.
This kind of page steering can accomplish some other functions, such as accessing the server-side controls on the previous page.


(3) Response.Redirect:
When the browser requests an ASPX page, the redirect (URL) method is encountered.
The equivalent of telling the browser that you first need to access a page, so the browser to the server to send a request to this page.
Relocation is performed through the browser, resulting in additional round trips between the server and the browser.
When the network condition is not very good, two requests will be greatly
Reduces the application's response speed and even consumes extra bandwidth.

Summarize:
In the case of good network condition, Redirect (URL) method is the most efficient!!
Server.Transfer method and Server.Execute method are most flexible!!
The Server.Execute method occupies the most resources.

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.