response

Tamer_Ahmed said:
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
 
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.
 
Back
Top