Milan Mendpara Milan Mendpara - 29 days ago 21
ASP.NET (C#) Question

Server.Transfer() Vs. Server.Execute()

im having confusion with which one is better or effect for request of calling page(first page) and caller page (new page) ...

i notice that In both the cases, the URL in the browser remains the first page URL (doesn’t refresh to the new page URL) as the browser isn’t requested to do so.

any comments appreciable ....

Answer

Orignal at : Difference between Server.Transfer and Server.Execute

Both Server.Transfer and Server.Execute were introduced in Classic ASP 3.0 (and still work in ASP.NET).

When Server.Execute is used, a URL is passed to it as a parameter, and the control moves to this new page. Execution of code happens on the new page. Once code execution gets over, the control returns to the initial page, just after where it was called. However, in the case of Server.Transfer, it works very much the same, the difference being the execution stops at the new page itself (means the control is'nt returned to the calling page).

In both the cases, the URL in the browser remains the first page url (does'nt refresh to the new page URL) as the browser is'nt requested to do so.

Comments