Tamer_Ahmed Posted August 19, 2004 Posted August 19, 2004 what is the different between response.redirect(mypage.aspx) and server.Transfer(mypage.aspx) Quote
PWNettle Posted August 19, 2004 Posted August 19, 2004 what is the different between response.redirect(mypage.aspx) and server.Transfer(mypage.aspx) Response.Redirect immediately shifts execution to the new URL (unless you use the override with the bool that lets the current page execute first). Server.Transfer works somewhat similarly, except that it also "forwards" the latest form post (Request.Form collection in code). The annoying part of Server.Transfer is that the URL doesn't change when you use it...so, for ex, if you were at login.aspx and did a Server.Transfer to pageone.aspx then the addressbar would still show login.aspx even though pageone.aspx executed and is displayed. I haven't use Server.Transfer much - but I guess in theory it could be handy - for example if you had a multi-page form you needed a user to fill out you could Server.Transfer them through each stage of the process to build-up one big set of post data that you eventually do something with. Paul Quote
*Gurus* Derek Stone Posted August 19, 2004 *Gurus* Posted August 19, 2004 Response.Redirect() sends a 301/303 HTTP response code to the browser informing it to redirect to the new resource. So, to be picky, execution isn't "shifted", it's completely restarted. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.