Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Response.Redirect vs Server.Transfer

5 views
Skip to first unread message

Harsh Thakur

unread,
Aug 18, 2003, 2:39:15 AM8/18/03
to
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


Steve C. Orr, MCSD

unread,
Aug 18, 2003, 3:00:28 AM8/18/03
to
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" <har...@cybage.com> wrote in message
news:urPevIVZ...@tk2msftngp13.phx.gbl...

Harsh Thakur

unread,
Aug 18, 2003, 4:03:58 AM8/18/03
to
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:euTqpZVZ...@TK2MSFTNGP09.phx.gbl...

Kevin Spencer

unread,
Aug 18, 2003, 8:47:25 AM8/18/03
to
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" <har...@cybage.com> wrote in message

news:%23$eeE4VZD...@TK2MSFTNGP09.phx.gbl...

Harsh Thakur

unread,
Aug 18, 2003, 9:13:53 AM8/18/03
to
Hi Kevin,

Thanks for your reply.

Regards
Harsh Thakur

"Kevin Spencer" <ke...@takempis.com> wrote in message
news:e9#U8gYZD...@tk2msftngp13.phx.gbl...

0 new messages