473,503 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.Transfer vs. Response.Redirect

Since both methods seem to produce the same results, in which cases
would you prefer one over the other? The only thing I would think is
using Server.Transfer because of some browsers blocking redirects.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
4 1845
Server.Transfer saves you one round trip to the client. As a result, client
is unaware of the transfer and keeps showing original url in its url field
which is misleading. Just one of the considerations.

Eliyahu

"Terry Olsen" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Since both methods seem to produce the same results, in which cases
would you prefer one over the other? The only thing I would think is
using Server.Transfer because of some browsers blocking redirects.

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #2
Response.Redirect tells the client the new URL that should be hit.

Server.Transfer is server side and the client doesn't know the new location
which could be a problem.

Still I've got mayself a hard time to find out a legitimate use for
Server.Transfer / Server.Execute. I always thought it's here mainly for
legacy as it always looks like to me the reason is that you embedded some
processing in a particular ASPX page which is not especially desirable ?

Hopefully someone will pop up with a legitimate use I didn't thought
about...

Patrice

--

"Terry Olsen" <to******@hotmail.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP14.phx.gbl...
Since both methods seem to produce the same results, in which cases
would you prefer one over the other? The only thing I would think is
using Server.Transfer because of some browsers blocking redirects.

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #3
Response.Redirect requires an extra round trip between the browser and the
server, therefore it is less efficient. However, at least this keeps the
browser informed of what's going on so it can display the correct URL in the
address bar.
Server.Transfer is more efficient, and it masks the true URL of the page
from the browser, which can be a good thing sometimes but is more often a
hassle (such as when the user reloads the browser page and the browser then
requests the wrong page.)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Terry Olsen" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Since both methods seem to produce the same results, in which cases
would you prefer one over the other? The only thing I would think is
using Server.Transfer because of some browsers blocking redirects.

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #4
Using the Transfer method is very similar to executing a hyperlink or using
the Redirect method, with one difference: Transfer can retain some
information from the source page across requests. Setting the Transfer
method' s preserveForm argument to True makes the form' s QueryString,
ViewState, and event procedure information available in the destination form.

To use the Transfer method with preserveForm set to True, you must first set
the EnableViewStateMac attribute in the Web form' s Page directive to False.
By default, ASP.NET hashes ViewState information, and setting this attribute
to False disables that hashing so the information can be read on the
subsequent Web form.

And You can't use the Transfer method with HTML pages. It works only with
..aspx pages. For example, Request.Redirect(“my_html.htm”) is right but
Server.Transfer(“my_html.htm”) is wrong.

HTH

Elton Wang
el********@hotmail.com

"Terry Olsen" wrote:
Since both methods seem to produce the same results, in which cases
would you prefer one over the other? The only thing I would think is
using Server.Transfer because of some browsers blocking redirects.

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4545
by: \A_Michigan_User\ | last post by:
Ok, I give up... why do 1-4 work fine... but 5-6 give "can't find" errors? 1. Client-side VBscript code: call navigate("\\209.11.22.33\MyDir") 2. Client-side VBscript code: location.href...
6
2221
by: StephenMcC | last post by:
Hi All, Got a quick query in relation to the Server.Transfer method available in IIS 5+/ASP. I've got an issue where I want to take a portion of an online app and extract this out into a web...
3
9059
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The...
4
2086
by: Harsh Thakur | last post by:
Hi, I'd like to know the performance related differences between Response.Redirect and Server.Transfer. I'd like to redirect the user to a different page. I can either do a...
5
7802
by: Julien C. | last post by:
Hi all, I have an "EditeItem.aspx" page which lets me edit properties of an "Item". In the OnClick() event of my Save button, I do save Item changes to the database and then I redirect the user...
8
3773
by: Cathie | last post by:
Hi guys, I want to do a Server.Transfer to get to a second page, so that I may retrieve variables I have set in the first page. I'm doing that with the usual Server.Transfer("pagename", true). ...
3
5472
by: Alan Silver | last post by:
Hello, Sorry if this is a stupid question, but I can't really see much difference between these tow methods according to the scant info in the SDK. Could anyone enlighten me? TIA -- Alan...
8
3870
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
9
4330
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
3
3510
by: jasonheath.net | last post by:
I apologize in advance for the length of this post. I wanted to get as much detail as possible in here. We have 1 web app that contains the functionality to do some single sign-on logic. The...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.