There are three methods for page redirection:
1. response. Redirect ("url ");
2. server. Transfer ("url ");
3. server. excute ("url ")
Server. Transfer ("url") has three advantages compared with the most common response. redirdbms ("url ").
Advantages:
1. It is directly redirected on the server side and does not need to communicate with the browser before redirecting like response. Redirect, which is highly efficient.
2. It can pass the submission value of the previous page. For example, if the value of page a is submitted to page B, and the value of page B is transferred to Page C, Page C can also receive the value submitted by page.
3. You can hide URLs.
Disadvantages)
You cannot refresh the page. For example, If logon information is submitted to page B on page A and transfer is sent to page a after page B is processed, page a cannot be refreshed, and the specified page does not expire. If pages A and B are not in the same directory, we will find more unexpected results. The images and hyperlinks with relative links have all changed, this is because page B reads the content of page a but outputs it as page B, so the path is changed.
There are four page navigation methods in Asp.net. How do I select one for your page?
· If you want users to decide when to convert a page and which page to go to, hyperlink is the most suitable.
· If you want to useProgramTo control the conversion target, but the conversion time is determined by the user. Use the web server's hyperlink control to dynamically set its navigateurl attribute.
· If you want to connect a user to resources on another server, use response. Redirect.
· Use response. Redirect to connect users to non-aspx resources, such as HTML pages.
· If you want to retain the query string as part of the URL, use response. Redirect.
· If you want to transfer the execution process to another ASPX page of the same web server, you should use server. transfer instead of response. redirect, because server. transfer can avoid unnecessary network communication to achieve better performance and browsing performance.
Reprinted from: http://www.fengfly.com/plus/view-80980-1.html