My quick recap!
Response.Redirect(string url)
- Sends a HTTP 302 to the client browser
- Client browser does a HTTP-GET of that new page
That's it.
Note to Redirect Method
Take a look at System.Web.HttpResponse.Redirect in Reflector and see how MS creates a hardcoded html, head, body construct... :-)
Before we meet Server.Transfer meet:
Server.Execute(string page)
- Executes the other page
- Control-flow jumps to new page and
- Returns back if finished...
Server.Transfer(string path)
- Sends all of the information that has been assembled for processing by one .aspx file to a the parameter path (.aspx page).
Insight to Server.Transfer
Server.Transfer does a Server.Execute(path, null, true);
but with a Response.End after return from Execute
last param = preserveForm
Advantages of Response.Redirect
Can redirect to external urls (even .html or classic asp-pages)
Url of new page is in browser adress bar
is this an advantage? :-)
Advantages of Server.Transfer
Server.Transfer can pass variables with HTTPContext.Items
PreviousPage property access is possible
Better performance cause no Client activity is involved
Server.Transfer bypasses the authorization for the page you redirect
References
http://www.dotnetframework.de/dotnet/aspnet2/RedirectVersusTransfer.aspx
http://codebetter.com/blogs/darrell.norton/archive/2003/08/26/1270.aspx
http://weblogs.asp.net/jgalloway/archive/2004/07/21/189547.aspx
http://techahead.wordpress.com/2007/10/14/aspnet-servertransfer-vs-responseredirect/
1 comment:
edwewerwerwe
Post a Comment