473,289 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

What's the difference between Response.Redirect and Server.Transfer?

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 Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #1
3 5454
Alan Silver <al*********@nospam.thanx> wrote in
news:5K**************@nospamthankyou.spam:
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.


Server.Transfer does a server side transfer.

Response.Redirect does a client side redirect - the server informs the
browser to redirect.

So here's the flow:

Server Transfer

1. Client Request Page HelloWorld.ASPX
2. Server.Transfer -> Server send a different page to the client
3. Client Receives Page still thinking it's HelloWorld.ASPX.
4. Client's URL (Address bar) remains HelloWorld.ASPX since the page was
sent on the server side and the client doesn't know a different page was
sent.

Response.Redirect

1. Client Requests Page HelloWorld.ASPX
2. Response.Redirect -> Server sends a HTTP header informing that the
user should redirect. 3. Client sees the redirect notice and requests
AnotherPage.ASPX 4. Server sends AnotherPage.ASPX
5. Client's URL (address bar) shows AnotherPage.ASPX

Technically speaking, Server.Trasfer is faster since there 1 less
roundtrip, but you lose the URL of the page. Server.Transfer also allows
for more flexibilty since you can use HTTPContext.Items to pass
variables beteen pages.

However, I only use Server.Transfer when i need to pass context items.
Otherwise I use Response.Redirect so the user will always see the
correct URL in the address bar.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Also, after a server.transfer, Context.Handler will refer to the initial
page, with no way of getting the new page (as far as i know)...certainly a
pita when you run into it and didn't know :)

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
Alan Silver <al*********@nospam.thanx> wrote in
news:5K**************@nospamthankyou.spam:
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.


Server.Transfer does a server side transfer.

Response.Redirect does a client side redirect - the server informs the
browser to redirect.

So here's the flow:

Server Transfer

1. Client Request Page HelloWorld.ASPX
2. Server.Transfer -> Server send a different page to the client
3. Client Receives Page still thinking it's HelloWorld.ASPX.
4. Client's URL (Address bar) remains HelloWorld.ASPX since the page was
sent on the server side and the client doesn't know a different page was
sent.

Response.Redirect

1. Client Requests Page HelloWorld.ASPX
2. Response.Redirect -> Server sends a HTTP header informing that the
user should redirect. 3. Client sees the redirect notice and requests
AnotherPage.ASPX 4. Server sends AnotherPage.ASPX
5. Client's URL (address bar) shows AnotherPage.ASPX

Technically speaking, Server.Trasfer is faster since there 1 less
roundtrip, but you lose the URL of the page. Server.Transfer also allows
for more flexibilty since you can use HTTPContext.Items to pass
variables beteen pages.

However, I only use Server.Transfer when i need to pass context items.
Otherwise I use Response.Redirect so the user will always see the
correct URL in the address bar.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #3
Thanks, that was a very clear answer.
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.


Server.Transfer does a server side transfer.

Response.Redirect does a client side redirect - the server informs the
browser to redirect.

So here's the flow:

Server Transfer

1. Client Request Page HelloWorld.ASPX
2. Server.Transfer -> Server send a different page to the client
3. Client Receives Page still thinking it's HelloWorld.ASPX.
4. Client's URL (Address bar) remains HelloWorld.ASPX since the page was
sent on the server side and the client doesn't know a different page was
sent.

Response.Redirect

1. Client Requests Page HelloWorld.ASPX
2. Response.Redirect -> Server sends a HTTP header informing that the
user should redirect. 3. Client sees the redirect notice and requests
AnotherPage.ASPX 4. Server sends AnotherPage.ASPX
5. Client's URL (address bar) shows AnotherPage.ASPX

Technically speaking, Server.Trasfer is faster since there 1 less
roundtrip, but you lose the URL of the page. Server.Transfer also allows
for more flexibilty since you can use HTTPContext.Items to pass
variables beteen pages.

However, I only use Server.Transfer when i need to pass context items.
Otherwise I use Response.Redirect so the user will always see the
correct URL in the address bar.


--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #4

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

Similar topics

6
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...
4
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...
4
by: batista | last post by:
Hello All, I want to know the Difference Between Server.Transfer() And Response.Redirect()?
9
by: odwrotnie | last post by:
Hi, what is the difference between Response.Redirect("Stop.aspx"); and Server.Transfer("Stop.aspx"); ? -- Best regards,
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
20
by: Simon Says | last post by:
Hi, I've a login page in which after authenticating it via the Oracle DB, I will stored the user information into the Session. However, when the Session timeout occurs, all of the user...
1
by: sajithamol | last post by:
What is the difference between Server.Transfer and Response.Redirect?
3
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...
2
by: Dale Harris | last post by:
Hi, I was wondering, is there a difference between Server.Transfer and Response.Redirect? They seem to do the same thing. Or am I mistaken? TIA ** Posted from http://www.teranews.com **
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.