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.
· If you want to capture the output result of An ASPX page and insert the result to a specific location of another ASPX page, use server. Execute.
· To ensure that the HTML output is valid, use response. Redirect instead of server. Transfer or server. Execute.
About server. Execute,
This page navigation method is similar to calling the callback function for the ASPX page. The called page can access the form data and query string set of the calling page, therefore, set the enableviewstatemac attribute of the called page command to false.
By default, the output of the called page is appended to the current response stream. However, server. the execute method has an overloaded method that allows a textwriter object (or its sub-object, such as the stringwriter object) to obtain the output of the called page, rather than directly appending it to the output stream, on the original page, you can easily adjust the location of the output result of the called page.