What is the difference?

O

odwrotnie

Hi,

what is the difference between
Response.Redirect("Stop.aspx");
and
Server.Transfer("Stop.aspx");
?
 
M

Mark Rae

what is the difference between
Response.Redirect("Stop.aspx");
and
Server.Transfer("Stop.aspx");

1) Launch your Internet browser (IE, FireFox, Netscape, Opera etc)

2) Navigate to http://www.google.com

3) Enter the text below in the box:

"Response.Redirect" "Server.Transfer" difference

4) Hit the button
 
C

Cowboy \(Gregory A. Beamer\)

Response.Redirect sends to the client with a META redirect and the client
requests the next page. Server. Transfer is solely on the server side.

Benefit of Reponse.Redirect: User can bookmark the redirected page

Benefit of server.Transfer: faster, as there is no trip to the client

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
C

Cowboy \(Gregory A. Beamer\)

Proving, I guess, that asking questions in this group is stupid? Or, perhaps
the questions you think are stupid do not deserve answering until the day
google dies? :)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
M

Mark Rae

Proving, I guess, that asking questions in this group is stupid? Or,
perhaps the questions you think are stupid do not deserve answering until
the day google dies? :)

Nope - merely trying to encourage people not to quite so lazy...

If the OP had done a simple Google search, they'd have had their answer
immediately rather than having to wait nearly two hours for you to tell
them...
 
O

odwrotnie

Response.Redirect sends to the client with a META redirect and the client
requests the next page. Server. Transfer is solely on the server side.

So how this transfer works? Is it have something in common with AJAX? And
why does the address stays unchanged with transfer?
Benefit of server.Transfer: faster, as there is no trip to the client

If there is no trip to the client, how does it works that the page is
displayed?
 
N

Nick Malik [Microsoft]

odwrotnie said:
So how this transfer works? Is it have something in common with AJAX? And
why does the address stays unchanged with transfer?


If there is no trip to the client, how does it works that the page is
displayed?

The asp.net model is based on the page controller pattern. ASP.Net provides
a page controller that gets the request, finds and executes the page, and
returns the HTML stream. Server.Transfer changes that flow.

So instead of this:
Controller gets request
Controller finds requested page
Controller loads and executes page
Controller wraps output of page in HTTP protocol and ships it back

You get this
Controller gets request
Controller finds requested page
Controller loads and executes page
Page tells controller to find a new page
Controller finds transferred page
Controller loads and executes page
Controller wraps output of page in HTTP protocol and ships it back

All this happens server side. The client is still waiting on their original
request and has no idea that it has occurred. It is quite normal for there
to be pages on the server that are ONLY accessible by server.transfer, where
the client gets the output but never sees the URL.

No, this has nothing to do with the Ajax model, although this mechanism can
be used for any web interaction, including Ajax, limited only by the
creativity of the developers and the requirements of the app.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top