Draw a detailed description of the differences among response. Redirect (), server. Execute (), and server. Transfer.

Source: Internet
Author: User

1. response. Redirect ();

Response. Redirect (); can be switched from Server 1 to server 2.The address bar in the browser displays the address of the new webpage. 

2. server. Execute (); only page conversions on the local server can be performed. The page conversion is not rigorous. To be precise, the page2 and page1 pages before the jump should be written to the buffer in sequence and output together.In this case, page2 is output first on the same page and then page1. but the address bar on the page still displays the address of the previous page.

3. server. Transfer (); can only be converted on the local server.Similar to server. Execute (), although the page is redirected, the address of the previous page is still displayed in the address bar of the webpage. However, unlike server. Execute () above, this method only outputs page2 pages.

Record: A friend asked me one question tonight: We used session in the developed OA project to only perform session detection on the second page after logon. What about other pages? If you enter the address of another page, can you directly access the address of another page?

Obviously, we only checked the OA operation page after login, and we did not perform session detection on other pages. However, please note that the redirection method we use is not response. redirect (), but server. transfer (), the advantage of this is that, although the user enters other OA operation pages, the user cannot see the address of the OA operation page, because the address bar still displays the address of the OA page after logon. Therefore, the possibility of directly entering addresses on other pages is extremely low.

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.