Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
68 views4 pages

4.1 Client Server Communication 4.1wer Server-Web Browser Communication 4.2.1 Request

The document discusses client-server communication in ASP.NET. It describes the Request and Response objects that allow communication between the web browser and server. The Request object gets information from the client, while the Response object sends output from the server to the user. It also discusses the Server object, which provides server-side information. Finally, it compares Server.Transfer and Response.Redirect - noting that Server.Transfer is handled by the server while Response.Redirect requires two requests, with the redirection handled by the browser rather than server. It recommends using Server.Transfer for same-server redirects and Response.Redirect for cross-server redirects.

Uploaded by

Meet Vaghasiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views4 pages

4.1 Client Server Communication 4.1wer Server-Web Browser Communication 4.2.1 Request

The document discusses client-server communication in ASP.NET. It describes the Request and Response objects that allow communication between the web browser and server. The Request object gets information from the client, while the Response object sends output from the server to the user. It also discusses the Server object, which provides server-side information. Finally, it compares Server.Transfer and Response.Redirect - noting that Server.Transfer is handled by the server while Response.Redirect requires two requests, with the redirection handled by the browser rather than server. It recommends using Server.Transfer for same-server redirects and Response.Redirect for cross-server redirects.

Uploaded by

Meet Vaghasiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

4.

1 Client server Communication

4.1Wer Server-web browser communication

4.2 Predefined objects of Asp.Net

4.2.1 Request

When a browser asks for a page from server, it is called a request. The Request object
used to get information from a client.

4.2.1 Response

The Response object is used to send output to the user from the sever.it was the only
way to write data to the page.

4.2.1 Server

This object is the instance of the system.web.HttpServerUtility class. It provides


MachineName Property which provides the name of the computer on which the page is
running.

“Server.Transfer”, following is the sequence of how the transfer happens:

1. User sends a request to an ASP.NET page. In the below figure, the request is sent to
“WebForm1” and we would like to navigate to “Webform2”.
2. Server starts executing “Webform1” and the life cycle of the page starts. But before the
complete life cycle of the page is completed, “Server.transfer” happens to “WebForm2”.
3. “Webform2” page object is created, full page life cycle is executed and output HTML response
is then sent to the browser.
“Response. Redirect”, following is the sequence of events for navigation:

1. Client (browser) sends a request to a page. In the below figure, the request is sent to
“WebForm1” and we would like to navigate to “Webform2”.
2. Life cycle of “Webform1” starts executing. But in between the life cycle “Response.Redirect”
happens.
3. Now rather than server doing a redirect, he sends a HTTP 302 command to the browser. This
command tells the browser that he has to redirect to “Webform2.aspx” page.
4. Browser interprets the 302 command and sends a GET request for “Webform2.aspx”.

• “Server.Transfer” is executed by the server while “Response.Redirect” is executed by


the browser.
• “Response.Redirect” needs two requests to do a redirect of the page.

So When to Use “Server.Transfer” and When to Use “Response.Redirect”?

• Use “Server.Transfer” when you want to navigate pages which reside on the same
server,
• use “Response.Redirect” when you want to navigate between pages which resides on
different server and domain.
.

Server.Transfer Response.Redirect
Redirection Redirection is done by the server. Redirection is done by the browser client.
Browser
Does not change. Changes to the redirected target page.
URL
When to Redirect between pages of the Redirect between pages on different server
use same server. and domain.
https://www.facebook.com/DotNetInterviewQuestions/videos/vb.341019362605680/7621861
50488997/?type=2&theater

You might also like