Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TransferRequest vs Transfer in ASP.Net

Tags:

I have gone through the links mentioned below,

iis forum and HttpModules & Server.Transfer / Server.TransferRequest / RewritePath problems. but unable to catch the concept behind these transfer methods.

How are they works? And which one is preferred in different situation?

Can someone explain me TransferRequest vs Transfer methods for server side transfer in asp.net and its roles?

Thanks in advance

like image 873
Sujit Avatar asked Feb 21 '13 12:02

Sujit


People also ask

What is difference between response redirect and Server transfer?

Response. Redirect simply sends a message (HTTP 302) down to the browser. Server. Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.

What is the use of response redirect ()?

Response. Redirect sends an HTTP request to the browser, then the browser sends that request to the web server, then the web server delivers a response to the web browser. For example, suppose you are on the web page "UserRegister. aspx" page and it has a button that redirects you to the "UserDetail.

What is Server transfer in C#?

Transfer(String, Boolean) Terminates execution of the current page and starts execution of a new page by using the specified URL path of the page. Specifies whether to clear the QueryString and Form collections. public: void Transfer(System::String ^ path, bool preserveForm); C# Copy.


2 Answers

HttpServerUtility.Transfer Terminates execution of the current page and starts execution of provided URL. This basically maps and executes a new ASP.NET Page (or serves a static file) corresponding to the url provided. It does this in-place in the current request pipeline, without applying new configuration to the new url, or re-running IIS modules for the new url. Because of this, its very fast, but it also prevents a lot of scenarios that are possible with TRQ.

HttpServerUtility.TransferRequest Performs an asynchronous execution of the provided URL. This is a full IIS child request under the covers, which allows it to re-run the entire request pipeline for the new request as if it was a separate request, getting the correct configuration for it, and running all of the normal IIS modules including authentication, authorization, etc. For example, IIS will apply the authorization rules for the new url, as opposed to the previous url.

like image 112
2 revs, 2 users 59% Avatar answered Oct 10 '22 09:10

2 revs, 2 users 59%


TransferRequest re-runs the entire request pipeline as if it were a separate request. This means that IIS and ASP.NET modules are re-applied; authentication and authorization rules for the new URL will be honored. Note that TransferRequest requires the integrated pipeline mode of IIS 7+, and the transfer can be to an ASP page or another resource like an XML file.

Transfer transfers execution from one ASP page to another ASP page on the server. Unlike TransferRequest, IIS and ASP.NET will NOT verify that the current user is authorized to view the resource delivered by the Transfer method. If you need to force reauthorization, and integrated pipeline mode is not an option, call Redirect instead of the Transfer method. Redirect triggers a client-side redirect so that the new request will be subjected to all authentication and authorization logic of IIS and ASP.NET.

like image 38
Robert Claypool Avatar answered Oct 10 '22 08:10

Robert Claypool