asp.net page Call Redirect,execute,transfer

Source: Internet
Author: User
Tags http request

asp.net page Call Redirect,execute,transfer

Use redirect when you want to jump the user to a page on another server

When you need to jump the user to a non-ASPX page, such as HTML using redirect

You need to use the query string as part of the URL

1 Response.Redirect This jump page method jump speed is not fast, because it wants to walk 2 back (2 times postback), but he can jump to any page, no Site page restrictions (that is, can be jumped from Yahoo to Sina), and can not skip login protection. But slow speed is its biggest flaw! REDIRECT Jump mechanism: First is to 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 side. Note that all the data information stored in the internal space after the jump is lost, so you need to use the session.

2 Server.Transfer speed, only need one postback, but .... He must be under the same site as it is a method of the server. In addition, he can skip login protection. You can write a small program to try: Design a page to page two of the jump, but to enter the page two need to login, form certification, but if the jump statement using transfer words, it will not pop-up login page. The redirection request of this method occurs on the server side, so the URL address of the browser still retains the address of the original page!

3 Sever.execute This method is mainly used in the page design, and he must be to jump the same site under the page. This method is needed to insert the output of one page into another ASPX page, mostly in a table where one page is similar to nesting in another.

  
Time to keep to the server, because the other 2 methods can not do 2 times postback, the data back to the server to use redirect

Requires a conversion between ASPX pages (not involving logins) using transfer

Use the Execute method when you need to insert the output of an ASPX page into another ASPX page.

Of course, forget there is also a hyperlink! Of course there's no need to talk too much about it. He is in need of the party user to decide when to jump the page, use the hyperlink.

Incidentally, how to use the Redirect method to use Chinese characters in the query string, because it is often garbled, because the URL does not support Chinese characters. This time you need to convert:

String Message =server.urlencode ("Welcome to the racing column");

Convert first, use query string

Response.Redirect ("webform2.aspx?msg=" +message);

Related Article

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.