Comparison of page Jump methods in Asp.net

Source: Internet
Author: User

Comparison of three methods provided by the jump page Asp.net

1 response. the redirect method does not jump quickly because it takes two rounds (two PostBack), but it can jump to any page, there is no website page restriction (that is, you can jump from Yahoo to Sina), and you cannot skip logon protection. However, slow speed is the biggest defect! Redirect jump mechanism: First, send an HTTP request to the client. The notification needs to jump to a new page, and then the client sends a jump request to the server. It should be noted that after the jump, all data information stored in the internal space will be lost, so session is required.

Server -------- notify client ---------- request jump to server
To pass the query string as part of the URL to another page, or to the HTML page
2 server. Transfer is fast, only one PostBack is required, .... It must be on the same site because it is a server method. In addition, he can skip logon protection. You can write a smallProgramTry: design a jump from page 1 to page 2, but login and form authentication are required to enter page 2. However, if the jump statement uses transfer, the logon page will not pop up. The redirection request of this method occurs on the server, so the URL address of the browser still retains the address of the original page!

The biggest feature of this method is that the URL is still the URL of the page before the jump. It is mainly used to transfer the execution process to another ASPX page of the same web server. BecauseIt retains the request and session values after the jump.
And you can use the data on the page before the jump.
3 sever.exe cute this method is mainly used in the page design, and he must jump to the page under the same site. This method needs to be used to insert the output results of a page to another ASPX page. Most of them are in the table, where a page is nested to another page.

After this method is executed, the program control will return to the jumpCodeThe Next Generation Code of is equivalent to our modal window. In this case, you can get the return value of the page that has been redirected.
It is often used to assist in selection, and then return the selected value to the current page.

Summary:


Use redirect to redirect a user to a page on another server.
When a user needs to jump to a non-ASPX page, such as HTML uses redirect
When the query string needs to be retained to the server as part of the URL, because the other two methods cannot achieve two PostBack operations, the data is first brought back to the server using Redirect
Switch between aspx pages (logon not involved) Using Transfer
Execute is used to insert the output result of the ASPX page to another ASPX page.
Of course, I forgot another hyperlink! Of course, you don't need to talk too much about this. He uses hyperlinks when the party needs users to decide when to jump to the page.

By the way, how to use the Redirect method to use Chinese Characters in query strings is often garbled because URLs do not support Chinese characters. In this case, the conversion is required:
String message = server. urlencode ("welcome to the racing column ");
Convert the query string first.
Response. Redirect ("webform2.aspx? MSG = "+ message );

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.