Interview Questions on ASP.NET Page navigation techniques


What are different page navigation techniques in ASP.NET?
Hyperlink control : Navigate to another page.
Response.Redirect : Navigate to another page from code. This is equivalent to clicking a hyperlink.
Server.Transfer : End the current Web form and begin executing a new Web form. This method works only when navigating to a Web Forms page (.aspx).
Server.Execute : Begin executing a new Web form while still displaying the current Web form. The contents of both forms are combined. This method works only when navigating to a Web Forms page (.aspx).
Window.Open script method : Display a page in a new browser window on the client.

What is the difference between Response.Redirect and Server.Transfer?
1.
When we use Server.Transfer the redirection happens on the server where as when we use Response.Redirect the redirection happens from the browser.
2. Server.Transfer is faster as there is no round trip involved while navigating from one webform to another webform.
Response.Redirect is slower than Server.Transfer as there is round trip from the server to the client browser.
3. Server.Transfer works only with .aspx files where as Response.Redirect works with .aspx and .Htm pages.
4. Server.Transfer will work with files on the same web server. You can't use Server.Transfer to send the user to an external site where as Response.Redirect can do that.
5. Server.Transfer does not update the URL in the browser. For example when you navigate from WebForm1.aspx to WebForm2.aspx using Server.Transfer the URL in the browser still shows WebForm1.aspx while you are actually looking at WebForm2.aspx. Response.Redirect updates the URL in the browser.


What is the use of Server.Execute method?
Server.Execute method is used to process a second Web form without leaving the first Web form. This technique lets you direct the results from a Web form to a region on the current page.

Is it possible to send a webform's QueryString, ViewState, and event procedure information to another webform?
Yes, we can use Server.Transfer or Server.Execute to send a webform's QueryString, ViewState, and event procedure information to another webform.

For this to work you have to set the preserveForm argument to True.To be able to read one Web form’s ViewState from another, you must first set the EnableViewStateMac attribute in the Web form’s Page directive to False. By default, ASP.NET hashes ViewState information, and setting this attribute to False disables that hashing so that the information can be read on the subsequent Web form.

14 comments:

  1. Very good article!

    ReplyDelete
  2. Great Article.Very easy to understand the concept.

    ReplyDelete
  3. Very good article. helps he to know in depth knolwledge

    ReplyDelete
  4. your articles are excellent..

    ReplyDelete
  5. This is the best place to visit for your final review before your interview!

    ReplyDelete
  6. why we create object for derived class

    ReplyDelete
  7. Sir,,,,,, u r great,Very few have caliber to give precious time to the people,,,,,

    ReplyDelete
  8. Hi Venkat, Could you pls brifly explain page life cycle,request life cycle and compilation life cycle

    ReplyDelete
  9. When i read blogs or watch videos of venkat sir it always add something new in my knowledge...thank you so much

    ReplyDelete
  10. Hi Venkat sir, your videos soo good,, i gain lot of knowledge through your videos, you'r one of the God's gift for .NET developers.

    ReplyDelete
  11. Can you please provide n-tier architecture videos. with Example.

    ReplyDelete

If you are aware of any other asp.net questions asked in an interview, please post them below. If you find anything missing or wrong, please feel free to correct by submitting the form below.

 
Disclaimer - Terms of use - Contact Us