ASP dot NET interview Questions with Answers
63ASP.NET QnA
#1. What methods are fired during the page load?
When the page loads the Init() method is invoked which initializes the global variables and the page is instantiated then the Load() method is called to load the page into the server memory. Once the page is loaded into the server the page requires to be pre-rendered for a brief period of time before showing the page as a HTML page to the client for this the pre-render() method is invoked. Lastly the Unload() method is triggered after the page loading is completed.
#2. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe for page loading process
Inetinfo.exe is the Microsoft IIS server which has many roles one of which is handling and running ASP.NET requests. When a client requests for an asp.net page (which has a .aspx extension) to an IIS web server, the ISAPI filter dll i.e aspnet_isapi.dll filters such request by checking the nature of the request if it is a valid asp.net page request then it is passed to the worker process of the web server i.e. the aspnet_wp.exe. The aspnet_wp.exe further carries out the main processing of the page requested for.
#3. State the difference between Server.Transfer and Response.Redirect
Server.Transfer instructs the web server to directly go to the requested page without performing any round trip to the client who initiated that event. It is for this reason that the url of the page doesnot change to reflect it on the clients browser. It is used because it is faster with reduced server overhead. Response.Redirect is used to redirect the browser of the client to another page or site. A client round trip is made in this method due to which the url of the client’s browser is updated.
#4. What is ViewState?
A web application is stateless in nature which means that on every post back the page gets loaded freshly flushing all the data values. To deal with this problem state management is required which can be done by many ways in ASP.NET one among them is ViewState. In ViewState the state of the objects (serializable) are stored in the hidden fields of a page. Then this ViewState acts as an object carrier between the client and the Server and it eradicates the need for storing data in server memory saving precious resources.
#5. What is the difference between ViewState and SessionState?
In ViewState the the object are serialized and stored in hidden fields within the page. After the post back the server updates this field with the new set of values for which any older value is destroyed. In SessionState a part of the memory of the server for a particular client is used to store client specific data. This data are available till the session is active after the session is abandoned these data are deleted.
#6. In asp.net 2.0 if same header and footer for number of pages are desired then what are the best ways to do with minimum level of coding?
Master page answers to this kind of problems where integrity is desired in every page of an application. A master page is a special page which has some of the basic standard controls through which it can be designed with proper functionalities. After that just by adding it to every page directives will enable the web server to generate a mixed result page out of the two pages. This will help to add same header/footer to any page.
#7. Explain connected and disconnected architecture in ADO.NET.
In connected architecture once the connection is established by Open() method a dedicated connection is maintained within that period of time all the data manipulation is done and after completion the connection is closed by Close(). But in disconnected architecture a mirror image of the database is brought on the client side and the connection suspends after that and that mirror image is updated by the client. When the update() is called the connection gets alive to update the database. This saves a huge connection bandwidth in e-commerce applications.
#8. What is Event Bubbling?
Event bubbling is a technique by which a child control handling is performed by its parent control. This is typically used in datagrid having several child controls say a column of linkbuttons. Instead of writing individual event handlers for every link button only one event routine on the parent control is written to handle its event. The parent can also know which child link button triggered the event through the CommandName argument. It is similar to a bubble evolving from lower control to upper control in the hierarchy.
#9. What methods must be used to ensure that only one process access a variable at a time?
The two methods from the HTTPApplicationClass namely lock() and unlock() are used to synchronize only one thread to access application state variables. Lock() method lets the ASP.NET to blocks other threads from accessing anything in application state. These blocked threads can only be unlocked by a method Unlock() only when it will be invoked by the thread that locked it.
#10. What are the different types of
caching?
Caching is a common method used to speed up the search process of frequently accessed data in a small memory (sometime called as cache memory). For web applications it is used to hold the page requests in order to reuse them cutting the hassle of recreating them. This enhances the response time and makes the whole process work faster. ASP.NET has 3 kinds of caching schemes Output, Fragment and Data Caching.
#11. State the difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript.
For returning blocks of client-side script consisting functions RegisterClientScriptBlock is used. While RegisterStartupScript is used for returning blocks of client-script not packaged in functions i.e. codes that are required to execute when the page is being loaded. Near the end of the document the latter positions of the scripts get blocked so elements on the page that the script interacts are loaded before the script can run.
PrintShare it! — Rate it: up down flag this hub




srini says:
6 months ago
visit www.srini-aspnet-tour.blogspot.com for very nice asp.net interview questions