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 invoked, the current ASPX page terminates execution, and the execution process is transferred to another ASPX page, but the new ASPX page still uses the reply stream created by the previous ASPX page.
If you use the Server.Transfer method to navigate between pages, the URL in the browser does not change, because the redirection is done entirely on the server side, and the browser has no idea that the server has performed 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 again request a new URL, the server returned to the new page, more than Server.Transfer one response.
In general, if you need to share data between two pages, and the amount of data is relatively large, with transfer will be more appropriate, in the second page can directly use the previous page of data,
eg
Transfertopage.aspx
Copy Code code as follows:
if (Context.Handler is transferfrompage)
{
Transferfrompage post= (transferfrompage) Context.Handler;
Startweekid=int32.parse (post. Ddlstartweek.selectedvalue);
Endweekid=int32.parse (post. Ddlendweek.selectedvalue);
}
A value that references the previous page control directly.
Redirect can pass some smaller string values.
Response.Redirect ("B.aspx?id=0&name=jeff");