.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> ASP.Net >> Post New Question Subscribe to Interview Questions

What's the difference between Response.Write() and Response.Output.Write()?

Posted By :iswarya     Posted Date :November 14, 2011    Points :40   Category :ASP.Net 
The latter one allows to write formatted output.

You can also find related Interview Question to What''s the difference between Response.Write() and Response.Output.Write()?  below: 

What's the difference between Response.Write() andResponse.Output.Write()?

  
Response.Output.Write() allows you to write formatted output but Response.Write doesnt allow.

Example:Response.Output.Write("{0:d}", "Current Date Time: ", DateTime.Now) (More...)

difference between Response.Output.Write() and Response.Write?

  
Response.Output.Write() is used to display formatted output while

Response.Write() can only display single character line. (More...)

What's the difference between Response.Write() andResponse.Output.Write()?

  
Response.Output.Write() allows you to write formatted output. (More...)

What is the difference between Server. Transfer and Response. Redirect?

  
The Transfer method allows you to transfer from inside one ASP page to another ASP page. All of the state information that has been created for the first (calling) ASP page will be transferred to the second (called) ASP page. This transferred information includes all objects and variables that have been given a value in an Application or Session scope, and all items in the Request collections. For example, the second ASP page will have the same SessionID as the first ASP page.

When the second (called) ASP page completes its tasks, you do not return to the first (calling) ASP page. All these happen on the server side browser is not aware of this.
The redirect message issue HTTP 304 to the browser and causes browser to got the specified page. Hence there is round trip between client and server. Unlike transfer, redirect doesn't pass context information to the called page.


Shashi Ray (More...)

Difference between Server.Transfer & Response.Redierect ?

  
Server.Transfer-

1)Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server.

2) Server.Transfer does not update the clients url history list or current url.

Response.Redirect-

1)Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page.

2) The user's browser history list is updated to reflect the new address. (More...)

Difference between Response.Expires and Response.ExpiresAbsolute?

  
Response.Expires
This property specifies the number of minutes before a page cached in the browser expires ie. if the user returns to the same page before the specified number of minutes the cached version of the page is displayed.


Response.ExpiresAbsolute
Using this property we can set the date and/or time at which page cached in the browser expires. (More...)

What is the difference between Server.Transfer and Response.Redirect?

  
* Response. Redirect: This tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.
* Server. Transfer: It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well. (More...)

Write and justify output of - select nullif('test','test')

  
The output will be - NULL
Justification : nullif returns NULl if given two arguments are same else returns the first specified argument. So, for the given SQL, output will be NULL. (More...)

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

  
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address. (More...)

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

  
Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist accros the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive. Response.Dedirect() :client know the physical loation (page name and query string as well). Context.Items loses the persisitance when nevigate to (More...)

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

  
Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist accros the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive.
Response.Dedirect() :client know the physical location (page name and query string as well). Context.Items loses the persisitance when nevigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they're difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems. As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.
(More...)

What is the difference between response.redirect and server.transfer ?

  
This is one of the favorite questions in ASP.NET Interviews. Every interviewer would like to know from the .NET candidate two things, how they differ technically and which scenarios should we use them.


Technical difference :- In Response.Redirect the following steps happen :-


1 - Client browser sends a signal to the server that he wants to go to xyz.aspx.2 - Server responds back to the browser about the location of xyz.aspx and tells the client to go to that

location.3- Client gets the response and redirects to xyz.aspx.


In server.transfer the the following step happens :-
1 - Client browser sends a signal to the server that he wants to go to xyz.aspx.2 - Server redirects to xyz.aspx and send the output to the client.
In other words in response.redirect there is a round trip while in server.transfer there are no round trips.


The next question what interviewer will ask is so does that mean we should always use server.trasfer and response.redirect is never needed.


Both of the are useful under different scenarios. Response.redirect is good when we want to go cross domains , in other words you want to redirect from http://www.questpond.com/ to http://www.microsoft.com/. Server.trasfer do not work when you go cross domains.

(More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend