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.
Subscribe to:
Post Comments (Atom)
Very good article!
ReplyDeleteVery good article
ReplyDeleteGreat Article.Very easy to understand the concept.
ReplyDeleteVery good article. helps he to know in depth knolwledge
ReplyDeletevery good artical
ReplyDeleteyour articles are excellent..
ReplyDeletenicely explained.
ReplyDeleteThis is the best place to visit for your final review before your interview!
ReplyDeletewhy we create object for derived class
ReplyDeleteSir,,,,,, u r great,Very few have caliber to give precious time to the people,,,,,
ReplyDeleteHi Venkat, Could you pls brifly explain page life cycle,request life cycle and compilation life cycle
ReplyDeleteWhen i read blogs or watch videos of venkat sir it always add something new in my knowledge...thank you so much
ReplyDeleteHi 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.
ReplyDeleteCan you please provide n-tier architecture videos. with Example.
ReplyDelete