.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 >> .NET Framework >> Post New Question Subscribe to Interview Questions

You can redirect (or) Transfer to a CustomError Page in which block?

Posted By :Syed Shakeer Hussain     Posted Date :November 21, 2009    Points :10   Category :.NET Framework 
Catch Block

You can also find related Interview Question to You can redirect (or) Transfer to a CustomError Page in which block?  below: 

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...)

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...)

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...)

Response.Redirect vs server.transfer

  
Response.Redirect sends message to the browser saying it to move to some different page.
While server.transfer does not send any message to the browser but rather redirects the user
directly from the server itself. So in server.transfer there is no round trip while response.
redirect has a round trip and hence puts a load on server.

(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...)

Difference between Server.Transfer and Cross Page Posting

  
In 'Server.Transfer', the URL doesn't change whereas in cross page posting, the form is submitted to a different page, thereby changing the url.
The Server.Transfer method is a server-based operation whereas cross-page postback is a client-based transfer. (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...)

Difference between Server.Transfer and
response.Redirect in asp.net?

  
Response.Redirect sends message to the browser indicating it to move to some other page, while server.transfer does not send any message to the browser but redirects the user directly from the server itself. So in server.transfer there is no round trip while response.redirect has a round trip and hence puts a load on server. (More...)

Can code inside multiple catch block be executed?

  
No, Code can not execute in mutiple catch block (More...)

Explain the life cycle of an ASP .NET page.

  
Life cycle of ASP.Net Web Form
Page Request >> Start >> Page Init >> Page Load >> Validation >>
PostBack Event Handling >> Page Rendering >> Page Unload
Page Request - When the page is requested ASP.Net determines
whether the page is to be parsed and compiled or a cached verion
of the page is to be sent without running the page.
Start - Page propertied REQUEST and RESPONSE are SET, if the
page is pastback request then the IsPostBack property is SET and
in addition to this UICulture property is also SET.
Page Initilization - In this the UniqueID of each property is SET.
If the request was postback the data is not yet loaded from the
viewstate.
Page Load - If it was a postback request then the data gets loaded
in the control from the ViewState and control property are set.
Validation - If any control validation present, they are performed
and IsValid property is SET for each control.
PostBack Event Handling - If it was a postback request then any
event handlers are called.
Page Rendering - Before this the viewstate is saved from the page
and RENDER method of each page is called.
Page Unload - Page is fully rendered and sent to the client(Browser)
and is discarded. Page property RESPONSE and REQUEST are unloaded. (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...)

cross page posting in ASP.NET2.0???

  
When we have to post data from one page to another in application we used server.transfer method but in this the URL remains the same but in cross page posting there is little different there is normal post back is done but in target page we can access values of server control in the source page.This is quite simple we have to only set the PostBackUrl property of Button,LinkButton or imagebutton which specifies the target page.In target page we can access the PreviousPage property.And we have to use the @PreviousPageType directive.We can access control of PreviousPage by using the findcontrol method.When we set the PostBackURL property ASP.NET framework bind the HTML and Javascript function automatically. (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