원본
http://www.c-sharpcorner.com/UploadFile/0c1bb2/response-redirect-and-server-transfer-in-Asp-Net/
원본 페이지:
Response.Redirect Vs Server.Transfer in ASP.pdf
- Response.Redirect
The Response.Redirect object transfers the page permanently to the next page and ends the processing of the first page and the new page processing continues on the redirected page but also it sends a command back to the browser; because of this one extra unnecessary round trip happens.
Suitable Uses
The suitable uses are:
- to redirect the page from the same as well as a different web server.
- don't care about causing additional round trips to the server on each request.
- do not need to preserve the Query String and Form Variables from the original request.
- want our users to be able to see the new redirected URL, where the page is redirected.
- want to bookmark the page.
- Server.Transfer
Server.Transfer navigates the pages within the same application or within the same server, the page is still in memory that can read the values directly from page2 on page1, in other words by using server.Transfer the page is not redirected permanently.
Suitable Uses
The suitable uses are:
- to transfer the current page request to another .aspx page on the same server.
- to preserve server resources and avoid the unnecessary round trips to the server.
- to preserve the Query String and Form Variables.
- don't need to show the real URL of where we redirected the request in the user's Web Browser.
- don’t want to bookmark the pages.
- "Start" - "All Programs" - "Microsoft Visual Studio 2010".
- "File" - "New WebSite" - "C#" - "Empty Web Site" (to avoid adding a master page).
- Provide the Project name such as "ResponseVsServer" or another as you wish and specify the location.
- Then right-click on Solution Explorer then seelct "Add New Item" - "Default.aspx" page (two web pages).
'.NET > .NET' 카테고리의 다른 글
asp.net How to get the id of the button user clicked (306) | 2014.01.23 |
---|---|
[ASP.NET] Life Cycle 문서링크 (0) | 2014.01.06 |
Difference between Application_Start and Application_OnStart (0) | 2013.12.26 |
How to include an external html file in asp.net page (0) | 2013.12.24 |
[.NET MVC] Controller to Return an Error Message Instead of a View? (0) | 2013.11.09 |