468,272 Members | 2,045 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

Response.Redirect vs Server.Transfer

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 Response.Redirect("URL") or a Server.Transfer("URL").
So I'd like to find out which is more efficient/better.
Can anyone please tell me or give any pointers to links on the web?

Thanks & Regards
Harsh Thakur
Nov 17 '05 #1
4 1874
From an efficiency perspective, there's no doubt that Server.Transfer is
better.
Response.Redirect requires a round trip back to the browser, while this is
unnecessary with Server.Transfer.
About the only downside to Server.Transfer is that, because all the action
stays on the server, the browser is not aware that the page has changed and
the original page's URL is still displayed in the browser. This can also
cause issues with the browser back button since the browser sees it as the
same page. If you can live with that then definitely go with
Server.Transfer.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire
"Harsh Thakur" <ha****@cybage.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
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 Response.Redirect("URL") or a Server.Transfer("URL").
So I'd like to find out which is more efficient/better.
Can anyone please tell me or give any pointers to links on the web?

Thanks & Regards
Harsh Thakur

Nov 17 '05 #2
Hi Steve,

Thanks for your response.
Now I feel much better about using Server.Transfer.

I have one more query though.
What happens to the Page object which invoked the Server.Transfer?
Lets say PageOne called Server.Transfer("PageTwo").
I know PageOne stays alive for a while longer.
When is it destroyed? Is it GC'd just like any other object?
I'd like to know this because it might mean extra memory load for the
server.

Actually, instead of using query strings, we expose a Get method on PageOne
and then call that method in the Page_Load of PageTwo.

Regards
Harsh Thakur

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
From an efficiency perspective, there's no doubt that Server.Transfer is
better.
Response.Redirect requires a round trip back to the browser, while this is
unnecessary with Server.Transfer.
About the only downside to Server.Transfer is that, because all the action
stays on the server, the browser is not aware that the page has changed and the original page's URL is still displayed in the browser. This can also
cause issues with the browser back button since the browser sees it as the
same page. If you can live with that then definitely go with
Server.Transfer.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire
"Harsh Thakur" <ha****@cybage.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
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 Response.Redirect("URL") or a Server.Transfer("URL").
So I'd like to find out which is more efficient/better.
Can anyone please tell me or give any pointers to links on the web?

Thanks & Regards
Harsh Thakur


Nov 17 '05 #3
The Page object is transferred also in the HttpContext. It is GC'd like any
other object. As for the memory load, I believe using Server.Transfer would
be more optimal, as it doesn't require the processing of 2 Requests.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Harsh Thakur" <ha****@cybage.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Steve,

Thanks for your response.
Now I feel much better about using Server.Transfer.

I have one more query though.
What happens to the Page object which invoked the Server.Transfer?
Lets say PageOne called Server.Transfer("PageTwo").
I know PageOne stays alive for a while longer.
When is it destroyed? Is it GC'd just like any other object?
I'd like to know this because it might mean extra memory load for the
server.

Actually, instead of using query strings, we expose a Get method on PageOne and then call that method in the Page_Load of PageTwo.

Regards
Harsh Thakur

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
From an efficiency perspective, there's no doubt that Server.Transfer is
better.
Response.Redirect requires a round trip back to the browser, while this is unnecessary with Server.Transfer.
About the only downside to Server.Transfer is that, because all the action stays on the server, the browser is not aware that the page has changed

and
the original page's URL is still displayed in the browser. This can also cause issues with the browser back button since the browser sees it as the same page. If you can live with that then definitely go with
Server.Transfer.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire
"Harsh Thakur" <ha****@cybage.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
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 Response.Redirect("URL") or a Server.Transfer("URL"). So I'd like to find out which is more efficient/better.
Can anyone please tell me or give any pointers to links on the web?

Thanks & Regards
Harsh Thakur



Nov 17 '05 #4
Hi Kevin,

Thanks for your reply.

Regards
Harsh Thakur

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
The Page object is transferred also in the HttpContext. It is GC'd like any other object. As for the memory load, I believe using Server.Transfer would be more optimal, as it doesn't require the processing of 2 Requests.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Harsh Thakur" <ha****@cybage.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Steve,

Thanks for your response.
Now I feel much better about using Server.Transfer.

I have one more query though.
What happens to the Page object which invoked the Server.Transfer?
Lets say PageOne called Server.Transfer("PageTwo").
I know PageOne stays alive for a while longer.
When is it destroyed? Is it GC'd just like any other object?
I'd like to know this because it might mean extra memory load for the
server.

Actually, instead of using query strings, we expose a Get method on PageOne
and then call that method in the Page_Load of PageTwo.

Regards
Harsh Thakur

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
From an efficiency perspective, there's no doubt that Server.Transfer is better.
Response.Redirect requires a round trip back to the browser, while
this is unnecessary with Server.Transfer.
About the only downside to Server.Transfer is that, because all the action stays on the server, the browser is not aware that the page has
changed
and
the original page's URL is still displayed in the browser. This can

also cause issues with the browser back button since the browser sees it as the same page. If you can live with that then definitely go with
Server.Transfer.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire
"Harsh Thakur" <ha****@cybage.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
> 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 Response.Redirect("URL") or a Server.Transfer("URL"). > So I'd like to find out which is more efficient/better.
> Can anyone please tell me or give any pointers to links on the web?
>
> Thanks & Regards
> Harsh Thakur
>
>



Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Justin | last post: by
5 posts views Thread by Paul de Goede | last post: by
2 posts views Thread by Nathan Sokalski | last post: by
3 posts views Thread by jasonheath.net | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.