The Server. Transfer Method transfers the execution process from the current ASPX file to another ASPX page on the same Server. When Server. Transfer is called, the current ASPX page is terminated and the execution process is transferred to another ASPX page. However, the new ASPX page still uses the response stream created on the previous ASPX page.
If you use the Server. Transfer method to implement navigation between pages, the URL in the browser will not change because the redirection is completely performed on the Server side, and the browser does not know that the Server has executed a page transformation.
Response. Redirect is the first time the client requests the Server to return status code 302 and a new URL. The client requests a new URL again, and the Server returns a new page, which is one more Response than Server. Transfer.
Generally, if you need to share data between two pages and the data volume is large, it is more appropriate to use transfer. On the second page, you can directly use the data on the previous page,
Eg:
TransferToPage. aspx
Copy codeThe Code is as follows:
If (Context. Handler is TransferFromPage)
{
TransferFromPage post = (TransferFromPage) Context. Handler;
StartWeekID = Int32.Parse (post. DdlStartWeek. SelectedValue );
EndWeekID = Int32.Parse (post. DdlEndWeek. SelectedValue );
}
Directly reference the value of the control on the previous page.
Redirect can pass some smaller string values.
Response. Redirect ("B. aspx? Id = 0 & name = Jeff ");