Hi all,
I am well confuse with
1) server.transfer
2) server.execute
3) server.response
4) response.redirect
Can any one explain with example.
Thanks,
M.Maheswar
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anuja PawarPosted Nov 29, 2011, 6:35 AM
Satyapriya NayakPosted Nov 29, 2011, 6:22 AM
There is no such called server.response.
Both "Server" and "Response" are objects of ASP.NET. Server.Transfer and Response.Redirect both are used to transfer a user from one page to another. But there is an underlying difference.
//Usage of Server.Transfer & Response.Redirect
Server.Transfer("Page2.aspx");
Response.Redirect("Page2.aspx");
Response.Redirect:- statement sends a command back to the browser to request the next page from the server. This extra round-trip is often inefficient and unnecessary, but this established standard works very well. By the time Page2 is requested, Page1 has been flushed from the server's memory and no information can be retrieved about it unless the developer explicitly saved the information using some technique like session, cookie, application, cache etc.
Server.Transfer:- method simply renders the next page to the browser without an extra round trip. Variables can stay in scope and Page2 can read properties directly from Page1 because it's still in memory. This technique would be ideal if it wasn't for the fact that the browser is never notified that the page has changed. Therefore, the address bar in the browser will still show "Page1.aspx" even though the Server.Transfer statement actually caused Page2.aspx to be rendered instead. This may occasionally be a good thing from a security perspective, it often causes problems related to the browser being out of touch with the server. Say, the user reloads the page, the browser will request Page1.aspx instead of the true page (Page2.aspx) that they were viewing. In most cases, Response.Redirect and Server.Transfer can be used interchangeably. But in some cases, efficiency or usability may be the deciding factor in choosing.
Server.Execute
When Server. Execute is used, a URL is passed to it as a parameter, and the control moves to this new page. Execution of code happens on the new page.
Once code execution gets over, the control returns to the initial page, just after where it was called.
Thanks
maheswar reddyPosted Nov 29, 2011, 6:21 AM
Now ,I become wiser on this topic .
Thanks
Anuja
Anuja PawarPosted Nov 29, 2011, 6:17 AM