Home ASP.Net Interview Questions and Answers

ASP.Net Interview Questions and Answers

What is page life cycle in c#.net Page Life Cycle EventsPage_Init
The server controls are loaded and initialized from the Web form’s view state. This is the first step in a Web form’s life cycle.
Page_Load
The server controls are loaded in the page object. View state information is available at this point, so this is where you put code to change control settings or display text on the page.
Page_PreRender
The application is about to render the page object.
Page_Unload
The page is unloaded from memory.
Page_Disposed
The page object is released from memory. This is the last event in the life of a page object.
Page_Error
An unhandled exception occurs.
Page_AbortTransaction
A transaction is aborted.
Page_CommitTransaction
A transaction is accepted.
Page_DataBinding
A server control on the page binds to a data source.
Process Request Method finally renders HTML Page
Name the namespace for Web page in ASP.NET. System.Web.UI.Page
Explain the differences between Server-side and Client-side code Server-side code executes on the server.
Client-side code executes in the client’s browser.
Server.Transfer and Response.Redirect.
Server.Transfer
Transfers page processing from one page directly to the next page.
No round-trip back to the client’s browser.
Faster response with lesser overhead on the server.
Server.Transfer does not update the clients url history list or current url

Response.Redirect
Used to redirect the user’s browser to another page or site.
Performs 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.

Define global.asax in ASP.NET The Global.asax is including the Global.asax.cs file.
You can implement application and session level events using global.asax
What are the Application_Start and Session_Start subroutines used for?
These subroutines set the variables for the Application and Session objects.
Define inline code and code behind Inline code written along side the html in a page.
Code-behind is code written in a separate file and referenced by the .aspx page
What is MSIL?
MSIL is the Microsoft Intermediate Language.
.NET compatible application will get converted to MSIL on compilation.
MSIL gets converted into machine language or native code by JIT compiler.
 
What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol
Define Boxing and Unboxing. Boxing allows you to treat a value type the same as a reference type.Unboxing converts a boxed reference type back to a value type.
Define ViewState in ASP.NET.
It allows the state of objects (serializable) to be stored in a hidden field on the page.
It is transported to the client and back to the server, and is not stored on the server or any other external source.
It is used to retain the state of server-side objects between postbacks.
What is the lifespan for items stored in ViewState?
Items stored in the ViewState exist for the life of the current page.
This includes postbacks (to the same page).
Different types of Session state management options available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management.
In-Process stores the session in memory on the web server.
Out-of-Process Session state management stores data in an external data source.
The external data source may be either a SQL Server or a State Server service.
Out-of-Process state management requires that all objects stored in session are serializable
What tag do you use to add a hyperlink column to the DataGrid? <asp:HyperLinkColumn>
What’s the difference between Response.Write() andResponse.Output.Write()? Response.Output.Write() allows you to write formatted output
Which method do you invoke on the DataAdapter control to load your generated dataset with data? The Fill() method.
Which template must you provide, in order to display data in a Repeater control? ItemTemplate.
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 
1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process . inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
9. What data type does the RangeValidator control support? Integer,String and Date.
What is the use of command objects? They are used to connect connection object to Data reader or dataset. Following are the methods provided by command object:-• ExecuteNonQuery: –

Executes the command defined in the Command Text property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.

• ExecuteReader: –

Executes the command defined in the Command Text property against the connection defined in the Connection property. Returns a “reader” object that is connected to the resulting row set within the database, allowing the rows to be retrieved.

• ExecuteScalar: –

Executes the command defined in the Command Text property against the connection defined in the Connection property. Returns only single value (effectively the first column of the first row of the resulting row set any other returned columns and rows are discarded. It is fast and efficient when only a “singleton” value is required

What is deployment? How do you deploy .Net Deployment – It is the procedure to deploy Web Application on the Server. You can deploy .Net application by simply Xcopy and create virtual directory for the application on server.
How different are interface and abstract class in .Net? When a class is not provided with full functionalitythen it is declared as abstract.it doesn’t support instance creation as well as it cannot be overridable to child class.interface is a colection of methods only without functionality.interface is 90% same as abstract class.
what is marshling? Marshaling performs the necessary conversions in data formats between managed and unmanaged code.CLR allows managed code to interoperate with unmanaged code usining COM Marshaler(Component of CLR).
How you can verify the result of your ASP.NET web services? 1. Calling the web services through browser.
2. Use visual studio debugger to step through the code.
3. Create ASP.NET web application and consume your ASP.NET web service.
What all steps are required to create an application to test your ASP.NET web services? 1. Create a web reference.
2. Create an instance of web reference.
3. Call the web method through instance of web reference.
Which method is used to serialize an object into an XML document from Xmlserializer class? Serialize
How is .NET able to support multiple languages? language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
What is smart navigation? The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
Can the validation be done in the server side? Or this can be done only in the Client side? Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.
How to manage pagination in a page? Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.
Can I deploy the application without deploying the source code on the server? Yes. You can obfuscate your code by using a new precompilation process called ‘precompilation for deployment’. You can use the aspnet_compiler.exe to precompile a site. This process builds each page in your web application into a single application DLL and some placeholder files. These files can then be deployed to the server.
You can also accomplish the same task using Visual Studio 2005 by using the Build->Publish menu.
Does ViewState affect performance? What is the ideal size of a ViewState? How can you compress a viewstate? Viewstate stores the state of controls in HTML hidden fields. At times, this information can grow in size. This does affect the overall responsiveness of the page, thereby affecting performance. The ideal size of a viewstate should be not more than 25-30% of the page size.
Viewstate can be compressed to almost 50% of its size. .NET also provides the GZipStream or DeflateStream to compress viewstate
How can you detect if a viewstate has been tampered? By setting the EnableViewStateMac to true in the @Page directive. This attribute checks the encoded and encrypted viewstate for tampering.
Can the App_Code folder contain source code files in different programming languages? No. All source code files kept in the root App_Code folder must be in the same programming language.
Update: However, you can create two subfolders inside the App_Code and then add both C# and VB.NET in the respective subfolders. You also have to add configuration settings in the web.config for this to work.
How do you secure your connection string information?
By using the Protected Configuration feature.
How do you secure your configuration files to be accessed remotely by unauthorized users? ASP.NET configures IIS to deny access to any user that requests access to the Machine.config or Web.config files.
How many web.config files can I have in an application? You can keep multiple web.config files in an application. You can place a Web.config file inside a folder or wherever you need (apart from some exceptions) to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.
I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy? By setting the element’s Override attribute to false.
Can you change a Master Page dynamically at runtime? How?
Yes. To change a master page, set the MasterPageFile property to point to the .master page during the PreInit page event.
Do webservices support data reader? No. However it does support a dataset.
What happens when you change the web.config file at run time? ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.
What is Ajax? The term Ajax was coined by Jesse James Garrett and is a short form for “Asynchronous Javascript and XML”. Ajax represents a set of commonly used techniques, like HTML/XHTML, CSS, Document Object Model(DOM), XML/XSLT, Javascript and the XMLHttpRequest object, to create RIA’s (Rich Internet Applications).
Ajax gives the user, the ability to dynamically and asynchronously interact with a web server, without using a plug-in or without compromising on the user’s ability to interact with the page. This is possible due to an object found in browsers called the XMLHttpRequest object.
What is ASP.NET AJAX? ‘ASP.NET AJAX’ is a terminology coined by Microsoft for ‘their’ implementation of AJAX, which is a set of extensions to ASP.NET. These components allow you to build rich AJAX enabled web applications, which consists of both server side and client side libraries
Explain the UpdatePanel? The UpdatePanel enables you to add AJAX functionality to existing ASP.NET applications. It can be used to update content in a page by using Partial-page rendering. By using Partial-page rendering, you can refresh only a selected part of the page instead of refreshing the whole page with a postback.
What is the global assembly cache (GAC)? GAC is a machine-wide cache of assemblies that allows .NET applications to share libraries. GAC solves some of the problems associated with dll’s (DLL Hell).
What is a COM Callable Wrapper (CCW)? CCW is a wrapper created by the common language runtime(CLR) that enables COM components to access .NET objects.
What is a Runtime Callable Wrapper (RCW)? RCW is a wrapper created by the common language runtime(CLR) to enable .NET components to call COM components.
What is garbage collection? Garbage collection is the process of managing the allocation and release of memory in your applications
Explain the ASP.NET Page Directives? Page directives configure the runtime environment that will execute the page. The complete list of directives is as follows:
@ Assembly – Links an assembly to the current page or user control declaratively.
@ Control – Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).
@ Implements – Indicates that a page or user control implements a specified .NET Framework interface declaratively.
@ Import – Imports a namespace into a page or user control explicitly.
@ Master – Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files.
@ MasterType – Defines the class or virtual path used to type the Master property of a page.
@ OutputCache – Controls the output caching policies of a page or user control declaratively.
@ Page – Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files.
@ PreviousPageType – Creates a strongly typed reference to the source page from the target of a cross-page posting.
@ Reference – Links a page, user control, or COM control to the current page or user control declaratively.
@ Register – Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control.
What is a User Control? User controls are reusable controls, similar to web pages. They cannot be accessed directly.
What is a Custom Control? Custom controls are compiled components that run on the server and that encapsulate user-interface and other related functionality into reusable packages. They can include all the design-time features of standard ASP.NET server controls, including full support for Visual Studio design features such as the Properties window, the visual designer, and the Toolbox.
What are the differences between user and custom controls? User controls are easier to create in comparison to custom controls, however user controls can be less convenient to use in advanced scenarios.
User controls have limited support for consumers who use a visual design tool whereas custom controls have full visual design tool support for consumers.
A separate copy of the user control is required in each application that uses it whereas only a single copy of the custom control is required, in the global assembly cache, which makes maintenance easier.
A user control cannot be added to the Toolbox in Visual Studio whereas custom controls can be added to the Toolbox in Visual Studio.
User controls are good for static layout whereas custom controls are good for dynamic layout.
What is the difference between ‘Web.config’ and ‘Machine.config’?
Web.config files are used to apply configuration settings to a particular web application whereas machine.config file is used to apply configuration settings for all the websites on a web server.
Web.config files are located in the application’s root directory or inside a folder situated in a lower hierarchy. The machine.config is located in the Windows directory Microsoft.Net\Framework\Version\CONFIG.
There can be multiple web.config files in an application nested at different hierarchies. However there can be only one machine.config file on a web server
What is a webservice? Web Services are applications delivered as a service on the Web. Web services allow for programmatic access of business logic over the Web. Web services typically rely on XML-based protocols, messages, and interface descriptions for communication and access. Web services are designed to be used by other programs or applications rather than directly by end user. Programs invoking a Web service are called clients. SOAP over HTTP is the most commonly used protocol for invoking Web services.
(A) What is event bubbling? Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which passed to the page as “ItemCommand” event. As the child control send events to parent it is termed as event bubbling
How many types of validation controls are provided by ASP.NET?
There are six main types of validation controls:-RequiredFieldValidator

It checks whether the control have any value. It is used when you want the control should not be empty.

RangeValidator

It checks if the value in validated control is in that specific range. Example TxtCustomerCode should not be more than eight lengths.

CompareValidator

It checks that the value in controls should match some specific value. Example Textbox TxtPie should be equal to 3.14.

RegularExpressionValidator

When we want the control, value should match with a specific regular expression.

CustomValidator

It is used to define User Defined validation.
Validation Summary
It displays summary of all current validation errors on an ASP.NET page.

Can you explain “AutoPostBack”? If we want the control to automatically post back in case of any event, we will need to check this attribute as true. Example on a Combo Box change we need to send the event immediately to the server side then set the “AutoPostBack” attribute to true.
How can you enable automatic paging in Data Grid? Following are the points to be done in order to enable paging in Data grid:-
• Set the “Allow Paging” to true.
• In PageIndexChanged event set the current page index clicked.
Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request
is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
Whats an assembly?
Assemblies are the building blocks of the .NET framework
What are the different types of caching? Caching is a technique widely used in computing to increase performance by keeping frequently accessed or expensive data in memory. In context of web application, caching is used to retain the pages or data across HTTP requests and reuse them without the expense of recreating them.ASP.NET has 3 kinds of caching strategiesOutput CachingFragment CachingDataCachingOutput Caching:

Caches the dynamic output generated by a request. Some times it is useful to cache the output of a website even for a minute, which will result in a better performance. For caching the whole page the page should have OutputCache directive.

Fragment Caching: Caches the portion of the page generated by the request. Some times it is not practical to cache the entire page, in such cases we can cache a portion of page
Data Caching: Caches the objects programmatically. For data caching asp.net provides a cache object for eg: cache[“States”] = dsStates

What do you mean by authentication and authorization
Authentication is the process of validating a user on the credentials (username and password) and authorization performs after authentication. After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization.
What’s the difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript?
RegisterClientScriptBlock is for returning blocks of client-side script containing functions. RegisterStartupScript is for returning blocks of client-script not packaged in functions-in other words, code that’s to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.
 
What is State management in ASP.NET?
State management is the process by which you maintain state and page information over multiple requests for the same or different pages.
There are 2 types State Management:
1. Client – Side State Management
This stores information on the client’s computer by embedding the information into a Web page, a uniform resource locator(url), or a cookie. The techniques available to store the state information at the client end are listed down below:

a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.

b. Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.

c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user’s browser. The data is available only when the form is processed.

d. Cookies – Cookies store a value in the user’s browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.

e. Query Strings – Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.

2. Server – Side State Management
a. Application State – Application State information is available to all pages, regardless of which user requests a page.

b. Session State – Session State information is available to all pages opened by a user during a single visit.

Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile properties.

How many types of cookies are there in ASP.NET ?
1. Single valuedrequest.cookies(”dotnetfunda”)=”Sheo”

2. Multi valued

request.cookies(”donetfunda”)(”uname”)=”MAJITH?

What is CAS?
CAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk. How does CAS work? The CAS security policy revolves around two key concepts – code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set. For example, using the default security policy, a control downloaded from a web site belongs to the ‘Zone – Internet’ code group, which adheres to the permissions defined by the ‘Internet’ named permission set. (Naturally the ‘Internet’ named permission set represents a very restrictive range of permissions.)
What are the various ways of authentication techniques in ASP.NET?
ASP.NET provides three ways to authenticate a user:* Windows authentication,
* Forms authentication, and
* Passport authentication
How to improve performance of web page in asp.net?
Minimize the use of ViewState, Session, Turn off tracing etc.
What is the difference between asp:Label and asp:Literal control?
asp:Label control
asp:Label control is used to write text on the page with different formatting options like bold, italic, underlined etc.
For more on asp:Label see http://dotnetfunda.com/tutorials/controls/label.aspx
asp:Literal control
Literal control is used to write simple text on the page, you can use server side formatting options like bold, italic, underlined.
For more on asp:Literal see http://dotnetfunda.com/tutorials/controls/literal.aspx
What is HttpHandler?
HttpHanlder is the low level Request and Response API to service incoming Http requests. All handlers implement the IHttpHandler interface. There is no need to use any extra namespace to use it as it contains in the System.Web namespace. Handlers are somewhat analogous to Internet Server Application Programming Interface (ISAPI) extensions.Each incoming HTTP request received by ASP.NET is ultimately processed by a specific instance of a class that implements IHTTPHanlder. IHttpHanlderFactory provides the infrastructure that handles the actual resolution of URL requests to IHttpHanlder instances. In addition to the default IHttpHandlerFactory classes provided by ASP.NET, developers can optionally create and register factories to support rich request resolution.
Difference between DataSet and DataReader
DataReader
===========
DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can’t do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction. As DataReader is forward only so we can’t fetch data randomly. .NET Data Providers optimizes the datareader to handle huge amount of data.
DataSet
=======
DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas.
DataSet is always a bulky object that requires a lot of memory space compare to DataReader. We can say that the DataSet is a small database because it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get the required data like querying database.
What is difference between Trace and Debug?
Use Debug class to debug builds
Use Trace class for both debug and release builds.
What is Script injection? A script injection attack attempts to send executable script to your application with the intent of having other users run it. A typical script injection attack sends script to a page that stores the script in a database, so that another user who views the data inadvertently runs the code.
What is SQL injection?
A SQL injection attack attempts to compromise your database by creating SQL commands that are executed instead of, or in addition to, the commands that you have built into your application.
What are the best practices to keep in mind when accepting user input on a web application?
1. Always use validation controls whenever possible to limit user input to acceptable values.
2. Always check the IsValid property of the aspx page. Run the server side code only if the IsValid property value is true. A value of false means that one or more validation controls have failed a validation check.
3. Always perform server side validation irrespective of client side validation being performed or not. This will protect your web application even if the client has by passed the client side validation by disabling javascript in the web browser.
4. Also make sure to re validate user input in the business logic layer of your application.
What are the steps to follow to avoid Script Injection attacks?
1. Encode user input with the HtmlEncode method. This method turns HTML into its text representation.
2. If you are using the GridView control with bound fields, set the BoundField object’s HtmlEncode property to true. This causes the GridView control to encode user input when the row is in edit mode.
What are the steps to follow to avoid SQL Injection attacks? Always use parameterized queries or stored procedures instead of creating SQL commands by concatenating strings together.
What’s the difference between private and shared assembly? Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name
What’s a strong name?
A strong name includes the name of the assembly, version number, culture identity, and a public key token
Where are shared assemblies stored? Global Assembly Cache..
How can you create a strong name for a .NET assembly? With the help of Strong Name tool (sn.exe)..
Can you have two files with the same file name in GAC?
GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so it’s possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version 1.0.0.0 and the second one is 1.1.0.0
What are the 3 different ways to store data in the Cache object? Use assignment.
Assigning a value to an unused key in the Cache object automatically creates that key and assigns the value to that key. Assigning a value to a key that already exists replaces the cached value with the assigned value.
Use the Insert method.
The Insert method uses parameters rather than assignment to create or change cached data. Insert optionally accepts parameters to establish dependencies and set expiration policy.
Use the Add method.
The Add method is similar to Insert; however, it requires all parameters and returns an object reference to the cached data
Which delegate can be used to notify the application when items are removed from the cache? onRemoveCallback is used to notify the application when items are removed from the cache.
How do you retrieve the value of a cache item stored in the servers memory You can retrieve the value of a cache item stored in the servers memory through the item’s key, just as you do with the Application and Session objects. Because cached items might be removed from memory, you should always check for their existence before attempting to retrieve their value, as shown in the following code:private void Button1_Click(object sender, EventArgs e)
{
if (Cache[“ChachedItem”] == null)
{
Lable1.Text = “Cached Item not found.”;
}
else
{
Lable1.Text = Cache[“ChachedItem”].ToString();
}
}
Which method can be used to remove data from the cache? Cache object’s Remove method can be used to remove data from the cache as shown in the following code example / sample.private void RemoveButton_Click(object sender, System.EventArgs e)
{
Cache.Remove(“CachedItem”);
}
How do you control how long data is cached? The Cache object’s Add and Insert method parameters allow you to control how long an item is stored in the server’s memory. In practice, these parameter settings provide only indirect control of how long data remains in memory. If your server runs low on available memory, ASP.NET recovers as much memory as possible from expired cache items. If that’s not enough, ASP.NET will unload unexpired items from the cache based on their priority and when they were last accessed
What happens when you access the Global.asax file from a browser? For security reasons, you can’t access the Global.asax file from a browser. If a user requests the Global.asax file from your Web site, he or she will receive an “This type of page is not served” error message.
What are the steps to follow to host a web application on a web server?
1. Use IIS to set up a virtual folder for the application.
2. Copy the Web application to the virtual directory.
3. Add any shared .NET components to the server’s global assembly cache (GAC).
4. Set the security permissions on the server to allow the application to access required resources.
What is the difference between weak-named .NET components and strong-named .NET components?
This difference is how the names are stored within the assembly. Weak names are not guaranteed to be unique and thus cannot be shared without potentially causing conflicts. Strong names are digitally signed and provide a public key that ensures there are no conflicts. Furthermore, .NET components with strong names can’t call unmanaged code (such as COM components) and thus avoid potential conflicts with dependencies.Weak-named .NET components must be individually copied to the /bin directories of the Web applications where they are used. Strong-named .NET components can be copied into the server’s GAC
How do you impersonate the ASP.NET worker process?
To use impersonation to run the ASP.NET worker process as a user other than ASPNET, set the identity element’s impersonation attribute in the application’s Web.config file.
What is Anonymous access?
Anonymous access is the way most public Web sites work. Sites containing public information allow anyone to see that information, so they don’t authenticate users. ASP.NET Web applications provide anonymous access to resources on the server by impersonation. Impersonation is the process of assigning a user account to an unknown user.
What are composite custom controls? Composite custom controls combine one or more server or HTML controls within a single control class, which can be compiled along with other control classes to create an assembly (.dll) that contains a custom control library. Once created, the custom control library can be loaded into Visual Studio .NET and used in the same way as the standard server and HTML controls.Composite custom controls are functionally similar to user controls, but they reside in their own assemblies, so you can share the same control among multiple projects without having to copy the control to each project, as you must do with user controls. However, composite controls are somewhat more difficult to create because you can’t draw them visually using the Visual Studio .NET Designer.
What are the steps to follow create and use a custom control in a Web application? 1. Create a solution containing a custom control project.
2. Add a Web application project to the solution, and set it as the startup project. You will use the Web application project to test the custom control during development.
3. Add a project reference from the Web application to the custom control project, and add an HTML @Register directive and control element to use the custom control on a Web form.
4. Create the custom control’s visual interface by adding existing controls to it through the custom control’s CreateChildControls method.
5. Add the properties, methods, and events that the custom control provides.
6. Build and test the custom control.
What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not? The Debug build is the program compiled with full symbolic debug information and no optimization. The Release build is the program compiled employing optimization and contains no symbolic debug information. These settings can be changed as per need from Project Configuration properties. The release runs faster since it does not have any debug symbols and is optimized.
Explain the differences between public, protected, private and internal. ?

These all are access modifier and they governs the access level. They can be applied to class, methods, fields.
Public: Allows class, methods, fields to be accessible from anywhere i.e. within and outside an assembly.

Private: When applied to field and method allows to be accessible within a class.

Protected: Similar to private but can be accessed by members of derived class also.

Internal: They are public within the assembly i.e. they can be accessed by anyone within an assembly but outside assembly they are not visible.

Can “this” be used within a static method? No ‘This’ cannot be used in a static method. As only static variables/methods can be used in a static method.
What is the difference between early-binding and late-binding?
Early binding – Binding at Compile Time
Late Binding – Binding at Run Time
Early binding implies that the class of the called object is known at compile-time; late-binding implies that the class is not known until run-time, such as a call through an interface or via Reflection.

Early binding is the preferred method. It is the best performer because your application binds directly to the address of the function being called and there is no extra overhead in doing a run-time lookup. In terms of overall execution speed, it is at least twice as fast as late binding.

Early binding also provides type safety. When you have a reference set to the component’s type library, Visual Basic provides IntelliSense support to help you code each function correctly. Visual Basic also warns you if the data type of a parameter or return value is incorrect, saving a lot of time when writing and debugging code.
Late binding is still useful in situations where the exact interface of an object is not known at design-time.

If your application seeks to talk with multiple unknown servers or needs to invoke functions by name (using the Visual Basic 6.0 CallByName function for example) then you need to use late binding. Late binding is also useful to work around compatibility problems between multiple versions of a component that has improperly modified or adapted its interface between versions.

How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
The hugely simplistic version is that every time it garbage-collects, it starts by assuming everything to be garbage, then goes through and builds a list of everything reachable. Those become not-garbage, everything else doesn’t, and gets thrown away. What makes it generational is that every time an object goes through this process and survives, it is noted as being a member of an older generation (up to 2, right now). When the garbage-collector is trying to free memory, it starts with the lowest generation (0) and only works up to higher ones if it can’t free up enough space, on the grounds that shorter-lived objects are more likely to have been freed than longer-lived ones.
Non-deterministic finalization implies that the destructor (if any) of an object will not necessarily be run (nor its memory cleaned up, but that’s a relatively minor issue) immediately upon its going out of scope. Instead, it will wait until first the garbage collector gets around to finding it, and then the finalisation queue empties down to it; and if the process ends before this happens, it may not be finalised at all. (Although the operating system will usually clean up any process-external resources left open – note the usually there, especially as the exceptions tend to hurt a lot.)
What is the difference between Finalize() and Dispose()?