AjaxControlToolkit’ TabContainer control’ Javascript functions in ASP.NET

AjaxControlToolkit’ TabContainer control’ Javascript functions.

In my previous two blogs we saw some javascript tricks to work with ASP.NET AJAX controls. The links to my previous blogs are
  • Calling validator controls from javascript.
  • Hide/Show validator callout control using javascript.
In this blog we will start with a common requirement for the tab container control i.e. setting focus to a tab using javascript and later at the end of this blog we will also see some important javascript functions available with ASP.NET AJAX Tab Container control.
One of the coolest controls in the ASP.NET AJAX is the TabContainer. Recently I had the requirement to show controls in tabs and also if there was any validation error in any of the tab I need to set focus on that tab as well. So if you also have the same requirement like you wanted to set focus to a particular tab of ASP.NET Ajax TabContainer control using javascript then read on. Below is the html code for the page having a tab container and some other asp.net controls like the validation control, validator callout etc.
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AJAXControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <AJAXControls:TabContainer runat="server" ID="tabContainer">
            <AJAXControls:TabPanel ID="firstTab" HeaderText="First Tab" runat="server">
                <ContentTemplate>
                    <asp:Label ID="Label1" runat="server">You are in the First tab. <br /> Press the submit button to see the validation result.</asp:Label>
                </ContentTemplate>
            </AJAXControls:TabPanel>
            <AJAXControls:TabPanel ID="secondTab" HeaderText="Second Tab" runat="server">
                <ContentTemplate>
                    <label id="Label2" runat="server">Please select a value from the drop down: </label>
                    <!--ASP.NET Drop down control-->
                    <asp:DropDownList ID="status" runat="server" >
                        <asp:ListItem Selected="True" Text="Select" Value="0" />
                        <asp:ListItem Text="One" />
                        <asp:ListItem Text="Two" />
                        <asp:ListItem Text="Three" />
                    </asp:DropDownList>
                    <!--ASP.NET Required Field Validator to validate the drop down.-->
                    <asp:RequiredFieldValidator ID="statusValidator" runat="server" ErrorMessage="Please choose a value other than 'Select'" ControlToValidate="status" InitialValue="0" Visible="true" Display="None">
                    </asp:RequiredFieldValidator>
                    <AJAXControls:ValidatorCalloutExtender ID="statusValidator_ValidatorCalloutExtender"
                        runat="server" TargetControlID="statusValidator">                     </AJAXControls:ValidatorCalloutExtender>                   
                </ContentTemplate>
            </AJAXControls:TabPanel>
        </AJAXControls:TabContainer>
        <br />
        <asp:Button ID="submit" Text="Submit" OnClientClick="javascript:return ValidatePage();"
            runat="server" />
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    </div>
    </form>
</body>
</html>
So in the above html code you can see we have an AjaxControlToolkit TabContainer control with two TabPanels having id as “firstTab” and “secondTab”. The first tab has a label control and the second tab has a dropdown control with a validation control attached to it and a ValidatorCalloutExtender control attached to the validation control. Also we have a submit button with “OnClientClick” event calling a javscript function called “ValidatePage”. Now the problem is whenever the submit button is pressed and if there is a validation error in the second tab the user is not informed of the same, reason being he is in the first tab and error has happened in the second tab. When the user manually clicks on the second tab he is able to see the error and if he doesn’t click the second tab the user is oblivious of the error. The solution to the problem is to set focus on the second tab whenever there is a validation error in the second tab. The javascript solution for the same is pasted below.
<script language="javascript" type="text/javascript">
function ValidatePage()
{
    // Getting the validation control using the new $get function.
    var valCntl = $get('<%=statusValidator.ClientID%>');
    if (valCntl != undefined && valCntl != null)
    {
        /*ValidatorValidate function executes the validation logic associated with the validation control. */
        ValidatorValidate(valCntl); 
    /*isvalid property is set to a boolean value by the ValidatorValidate based on whether the validation logic associated with the validation control was successful or not. */
        if (!valCntl.isvalid)
        {
        /*User defined method to hide the validator callout control.
            hideValidatorCallout(); */
        /*Retrieving the tab container control using new $get javascript function. */
            var tabContainer = $get('<%=tabContainer.ClientID%>');
            if (tabContainer != undefined && tabContainer != null)
            {
                tabContainer = tabContainer.control;
                tabContainer.set_activeTabIndex(1);
                showValidatorCallout();
            }
            return false;
        }
        return true;
    }
}
function hideValidatorCallout()
{    
    /*Below code hides the active AjaxControlToolkit ValidatorCalloutExtender control. */
    AjaxControlToolkit.ValidatorCalloutBehavior._currentCallout.hide();
}
function showValidatorCallout()
{
    /*Gets the AjaxControlToolkit ValidatorCalloutExtender control using the $find method. */
    AjaxControlToolkit.ValidatorCalloutBehavior._currentCallout = $find('<% =statusValidator_ValidatorCalloutExtender.ClientID %>');
    //Below code unhides the AjaxControlToolkit ValidatorCalloutExtender control.
    AjaxControlToolkit.ValidatorCalloutBehavior._currentCallout.show(true);
}
</script>
If you see in the above code we are calling ValidatePage javascript method on the button’ OnClientClick event. Inside the function we are making a call to the ValidatorValidate method with the validation control as the argument. Once that is done I am checking whether the validation logic associated with validation control has executed successfully or not by checking the isvalid property of the validation control. If the validation is not successful I am getting the tab container control using the “$get” javascript method. Once the tab container is retrieved the following two lines sets the focus to the desired tab.
tabContainer = tabContainer.control; 
tabContainer.set_activeTabIndex(1);
Once you retrieve the tab container object using the “control” property one can use “set_activeTabIndex” to set the focus to the required tab. The “set_activeTabIndex” method takes an integer (tab index) value as the argument. Using the “set_activeTabIndex” javascript method one can set focus to the required tab.
I have used a new javascript function called “$get” to retrieve an element. In my previous blog I have used “$find”, we will see the difference between these two in my next blog but for the time being just understand that “$get” is the short cut for “document.getElementById” javascript method.
Some other useful tab container control’ javascript functions
Below I have listed some of the important javscript functions which may be of use for developers like us. These methods can be used only after one has retrieved the ASP.NET AJAX TabContainer control using the following code “TABCONTAINER_CONTROL.control” as shown in the above codes.
Method Explanation
get_activeTab()
returns the current active tab javascript object i.e. the tab which is in focus. This javascript function gets the active tab object.
get_activeTabIndex()
gets the active tab index. The function returns an integer value of the active tab.
get_id() gets the id of the tab container control.
get_tabs() gets an array of all the tabs in a tab container control. The function returns a javascript array containing all the tabs in the tab container control.
get_visible()
returns a boolean value indicating whether the tab container is visible or not.
getFirstTab() gets the first tab in the tab container control. The function returns a tab having tab index 0.
getLastTab() gets the last tab in the tab container control. The function returns a tab object having tab index = (tab count) –1.
getNearestTab()
gets the nearest tab. If the current tab index is 0 then the method will return second tab i.e. the tab having tab index as 1 and if the tab index is greater than 0 the function will return the previous tab i.e. the tab having index = [Current Tab Index] – 1.
getNextTab()
gets the next tab in the tab container control i.e. if the current active tab is the last tab then the function will return the first tab as the next tab else it will return the next tab ([Current Tab Index] + 1)
getPreviousTab()
gets the previous tab in the tab container control i.e. if the current tab index is 0 then the function returns the last tab else it returns the previous tab ([Current Tab Index] - 1)
set_activeTab(tabControl)
sets the active tab. The function takes a tab object as its argument and sets the tab as the active tab.
set_activeTabIndex(integer)
functions takes an integer value starting from 0 to tab collection length – 1 as an argument and sets the tab’ index matching the integer value as the active tab.
set_id()
sets the id for the current tab container control.
set_visible(Boolean)
function takes a Boolean value and based on the value, hides or shows the tab container. The function/property makes the whole tab container control visible or invisible. To make individual tabs visible or invisible you need to work with the tabs property as shown in the below table.
Individual Tab object’ javascript functions
The above functions are related to the tab container control. There may situation where one might want to work with individual tab objects. To work with individual tabs one has to retrieve the individual tab by making us of any of the above tab retrieval functions from the table and then one can work with the individual tab. Sample e.g to retrieve individual tab is given below.
tabContainer = tabContainer.control;
//Retrieving the tab using the get_activeTab method/property
var tab = tabContainer.get_activeTab();
var headerText = tab.get_headerText();
alert(headerText);
//Another way of retrieving the tab using the get_previousTab method/property
tab = tabContainer.getPreviousTab();
alert(tab.get_tabIndex());
Once you have retrieved the individual tab using any of the above methods you can make use of some of the useful methods listed in the table below to work with the tab object. The methods listed in the below table are not the complete list but they are some of the methods which I feel may be useful for developers.
Methods Explanation
addCssClass(className) sets the CSS class. The function takes the CSS class name as the argument. You can make use of this javascript function to change the CSS class of a tab at runtime through javascript.
get_enabled()
gets a Boolean value indicating whether the tab is enabled or not (disabled). The function returns true or false.
get_headerText()
gets the header text of the tab. The function returns string containing the header text.
get_id() gets the id of the tab.
get_tabIndex() gets the tab index of the tab object. The function returns an integer.
get_visible() gets whether the tab is visible or not. The function returns a boolean value.
removeCssClass(className)
removes the CSS class based on the class name passed in the argument.
set_enabled(Boolean)
enables or disables the tab object based on the boolean value passed.
set_headerText(string)
function sets the header text for tab. Functions takes a string as an argument and sets the string as the header text.
set_id() sets the id for the tab.
set_visible(Boolean)
sets the visibility of the tab based on the boolean argument passed. The boolean value makes the tab visible or invisible.
In my next blog we will see the difference between $find and $get. Till then try to know more.

websites for silverlights

http://www.microsoft.com/library/errorpages/smarterror.aspx?aspxerrorpath=http%3a%2f%2fwww.microsoft.com%2fsilverlight%2foverview%2fmobile.aspx
.................................................................................................................

http://www.learn-silverlight-tutorial.com/

..............................................................................................

http://www.learn-silverlight-tutorial.com/TheSilverlightFramework.cfm
......................................................................................................................
http://www.silverlight.net/learn/tutorials/silverlight-4/
........................................................................................
http://www.dotnetspider.com/Silverlight-Tutorials.aspx

..............................................................................................




What is silverlight ?

Silverlight is a web based technology, launched by Microsoft in April 2007. Silverlight is considered as a competitor to Adobes Flash.

Silverlight applications are delivered to browsers in a text-based markup language called XAML. One important difference between Flash and XAML is, Flash is a compiled application where as XAML is text based. Search engines can analyze and index such content, which is a huge benefit for webmasters.

For regular internet users, Silverlight is a browser plug-in that supports video, audio and animations.

For web developers, Silverlight offers much more. Silverlight supports video and audio files without need of much programming. It allows them to handle events from web pages (like handle start/end of video playing etc)

Difference between Silverlight and WPF


Silverlight and Windows Presentation Foundation (WPF) are 2 different products from Microsoft, but has lot of overlap. Silverlight is a sub set of WPF in terms of features and functionality.

Silverlight is a Microsoft technology, competing with Adobes Flash and is meant for developing rich browser based internet applications.

WPF is a Microsoft technology meant for developing enhanced graphics applications for desktop platform. In addition, WPF applications can be hosted on web browsers which offers rich graphics features for web applications. Web Browser Appliactions (WBA) developed on WPF technology uses XAML to host user interface for browser applications. XAML stands for eXtended Application Markup Language which is a new declarative programming model from Microsoft. XAML files are hosted as descrete files in the Web server, but are downloaded to the browsers and converted to user interface by the .NET runtime in the client browsers.

WPF runs on .NET runtime and developers can take advantage of the rich .NET Framework and WPF libraries to build really cool windows applications. WPF supports 3-D graphics, complex animations, hardware acceleration etc.

An Overview of Silverlight

Silverlight enables development of the next generation of Microsoft .NET-based media experiences and rich interactive applications (RIAs) for the Web. Silverlight is delivered as a cross-platform and cross-browser plug-in that exposes a programming framework and features that are a subset of the .NET Framework and Windows Presentation Foundation (WPF).

Support

The industry has been abuzz about Silverlight since the beginning of 2007 when Microsoft began demonstrating its power at developer conferences. In fact, no other development technology has been so highly anticipated since the arrival of the .NET Framework and Silverlight resources and examples abound on the Web. To spark developer interest in Silverlight, Microsoft launched several community Web sites dedicated to Silverlight development including the Silverlight home page (http://www.microsoft.com/silverlight) and the Silverlight.net community Web site (http://silverlight.net).

Early Adopters

In response to the overwhelming developer community anticipation for the arrival of Silverlight, many developers and companies have become early adopters of the technology.
Some example sites are listed below:
  • World Series of Poker
  • Discovery Channel
  • The Emmys
  • Home Shopping Network (HSN)
  • World Wrestling Entertainment (WWE)
  • Fox
  • XBOX 360
  • Netflix - uses Silverlight to allow subscribers to instantly watch movies on their PCs or Intel-based Macs.
Many of the published early adopter applications are featured in the Silverlight.net showcase.

The .NET Framework

Microsoft introduced the .NET Framework in 2000 as a new approach to software development. The .NET Framework borrowed ideas from the best practices in the software industry as well as brought new ideas to the table in an effort to meet developer needs and requests.
Virtually all programming languages manage data at some point. The primary reason that communication between applications created using C++, Visual Basic, Visual FoxPro, and other languages was difficult was because each language stored data being managed in a unique set of data types. For example, an integer in one language may not represent an integer in another language. Data needed to be converted to common data types to communicate between languages.
The .NET Framework introduced a common set of data types (the Common Type System) that is used by all .NET-compliant languages (C++, Visual Basic, C#, etc). Thus all languages can easily intercommunicate. Furthermore, all .NET-compliant languages render a common result when compiling code, Microsoft Intermediate Language (MSIL). (see footnote) MSIL can be deployed to any platform running the Common Language Runtime (CLR). Currently, the CLR is only available for Microsoft Windows although an open source version of the CLR was created for Linux (called the Mono Project). Code written by using the .NET Framework is compiled instead of interpreted resulting in much better performance than Java and competing technologies.
Microsoft took the Web development industry by storm with their .NET upgrade to ASP. ASP.NET put a new face on Web development through a compiled code architecture and improved state management and it provides access to the full functionality of the .NET Framework. ASP.NET is built around XML, supports the latest Web development standards, and allows for the creation of advanced Web Services.
The .NET Framework also provides improved data access and database integration through ADO.NET. For more information, see MSDN.
There are many more features and benefits of the .NET Framework than those mentioned here. The .NET Framework has become the leading software development environment available.

Introducing Silverlight

What's New in the .NET Framework

As of the writing of this course, version 3.5 of the .NET Framework has been released. Version 3.5 includes features that encompass all facets of Windows, Web, and network development:
  • Includes just under 10,000 classes, methods, and properties.
  • Complies with the latest Web development standards.
  • Introduces revolutionary technologies used in Windows Vista development, rich media and user experiences, workflow management, security and authorization, and complete distributed communication protocols.
The .NET Framework can also be fully extended by developers to create custom classes and types. The functionality of the .NET Framework spans the server, the workstation, and the Web. The four primary additions to the .NET Framework as of version 3.0 are:
  1. Windows Presentation Foundation (WPF)
  2. Windows Communication Foundation (WCF)
  3. Windows Workflow Foundation (WF)
  4. CardSpace

Windows Presentation Foundation (WPF)

WPF is used to develop elaborate user interfaces like those that adorn Windows Vista and managed advanced media streaming and integration. WPF is the a complete revamp of Windows Forms so that user interface, graphic, and media development is now designed around the .NET Framework.

Windows Communication Foundation (WCF)

WCF encompasses the ASP.NET Web Services and .NET remoting functionality that was contained in the .NET Framework 2.0 as well as new communication technologies.

Windows Workflow Foundation (WF)

WF is used to model complex workflow processes.

CardSpace

CardSpace is the embodiment of new security and user authorization functionality.

ASP.NET AJAX

ASP.NET AJAX was developed to improve performance in the browser by making post backs and calls between the browser and server asynchronously. ASP.NET AJAX uses new built-in types and controls and JavaScript.
Both ASP.NET and ASP.NET AJAX are heavily dependent upon the ASP.NET page event life cycle, are tightly coupled to the server, and have a tough time competing with advanced, media-rich plug-in solutions such as Adobe Flash. Additionally, it is difficult to create Web applications that offer a consistent experience across all supported browsers and platforms by using ASP.NET and AJAX. In 2006, Microsoft began developing a solution to extend into the browser and offer media experiences more robust than competing plug-in solutions.
In 2007, Microsoft introduced Silverlight. (see footnote) Silverlight is a free plug-in that encompasses a subset of functionality from the .NET Framework and WPF. In a manner similar to the JVM (see footnote), Silverlight runs in the browser as a "sandbox" - a secure zone installed into the browser that accommodates Silverlight functionality while completely protecting the host platform from any possibly adverse actions performed by Silverlight.

Silverlight Architecture

Unlike ASP.NET, the bulk of Silverlight processing occurs on the client machine thus decreasing server resource utilization and improving the Web experience on the client. The figure below shows the difference between ASP.NET processing and Silverlight processing:
When a client initially attempts to run a Silverlight application, if the Silverlight plug-in has not been installed on the client machine, it will be downloaded and installed. Upon subsequent requests to run the application, the application will instantiate on the client machine and make requests for resources from the server only when necessary. The Silverlight plug-in can be thought of as a scaled-down version of the full .NET Framework. It only contains those classes and functionality that are applicable to a Silverlight Web client and those were streamlined and optimized for use on the Web client machine.
Silverlight was designed using the same design paradigm as ASP.NET. Each page of a Silverlight application includes an associated code behind file that includes the code that handles events fired by the page. Silverlight resembles WPF in that it uses Extensible Application Markup Language (XAML) to construct the user interface (presentation layer). As Silverlight applications are composed of text-based files that include markup and code, they can be created using any text editor; however, more advanced tools and development environments such as Visual Studio or Expression Blend simplify the task significantly.

Silverlight Technologies

Version 1.0 of Silverlight used JavaScript and supported the industry-leading Windows Media Services enabling delivery of audio and video that includes 2D and vector graphics.
Version 2 includes all features of version 1.0 and:
  • support for the .NET Framework.
  • support for .NET-compliant programming languages such as C#, Visual Basic, Python, and Ruby.
  • support for database operations and language-integrated query (LINQ).
The figure below illustrates the major differences between version 1.0 and version 2:
The diagram located at ClassFiles/WhatIsSilverlight/Demos/SilverlightTechnologyMap.gif gives a broad picture of the technologies to be supported by Silverlight version 2.

Silverlight Hosting

Microsoft Silverlight functionality is completely encapsulated within the Silverlight plug-in. Web applications typically require the server hosting the Web application to meet minimum requirements. Silverlight applications simply require a Web server to be equipped as they would be for hosting HTML documents. Silverlight applications can be hosted on any Web server accessible to the target audience. The two most commonly used Web servers are Microsoft Internet Information Server (IIS) and Apache.
Executing a Silverlight application on a Web client machine is a two step process. First, the application will detect if the Silverlight plug-in is installed on the Web client machine. If the plug-in is not installed, the user will be prompted with an option to download the plug-in. If the user opts to do so, a request will be made of the Web server to download and install the plug-in. The Silverlight plug-in is embodied in a .dll executable file that is loaded into the Web client browser memory once installed. The only interaction required by the Web client when installing the Silverlight plug-in is to grant permission for the plug-in to be installed. Various Web servers, including Microsoft Internet Information Server (IIS), may require slight configuration modifications so that the Silverlight executable file will be downloaded to the Web client when requested.
Second, once the Silverlight plug-in is installed on the Web client machine, the Silverlight application itself must be downloaded. A Silverlight application may consist of many types of files. Slight configuration modifications may be necessary on the Web server, such as MIME types, so that XAML and XAP files are associated with Silverlight and downloaded correctly to the Web client machine when requested.
Once the Silverlight plug-in is installed on a Web client machine and a Silverlight application is downloaded, the Silverlight application is then hosted on the Web client machine. There are some requirements necessary for the Web client machine as discussed in the sections below, however all media players, audio and video codecs, compilers and the runtime are encapsulated in the Silverlight plug-in.

Supported Platforms

Silverlight can be installed on Windows and Macintosh machines. Silverlight applications run within the confines of a plug-in. There are many benefits to using a plug-in with the primary benefit being consistency across implementations. A plug-in application can provide a consistent result in every instance where it is supported. Other plug-in solutions, such as Adobe Flash, have become popular due to consistency across implementations. For instance, a plug-in application should deliver a consistent result regardless of whether it is displayed using Internet Explorer on Windows or Safari on a Macintosh.
Silverlight 2 is currently supported on the platforms discussed below. (see footnote)
Platforms that Support Silverlight 2
Operating System Browser
  • Windows Vista
  • Windows XP SP2
  • Windows 2000
  • Windows Server 2003
  • Internet Explorer 7+
  • Firefox 1.5+
  • Google Chrome
  • Macintosh OS 10.4.8+ (Intel Based)
  • Safari
  • Firefox 1.5+

Linux

Many developers are unaware that a version of the .NET Framework exists for the Linux operating system. Linux is an open source operating system that is supported heavily in the online community. The version of the .NET Framework that supports Linux is named the Mono project and was also developed by the open source community. The developers of the Mono project keep the project close to in sync with the .NET Framework when updates are released by Microsoft and created an initial, limited version of Silverlight (called "Moonlight") that supports Linux in approximately 21 days! (see footnote) You can get up to date information on this project at http://www.mono-project.com/Moonlight.

Future Platforms

The Silverlight plug-in renders graphics and multimedia using a vector-based graphics engine. Vector graphics can easily be scaled from very small displays to very large displays of varying resolutions with virtually no loss of image quality. Silverlight on a Windows Mobile device will accommodate delivering live, streaming, high quality video to smart phones and similar devices. The goal is to enable developers to deliver rich interactive applications (RIA) to any type of device.
Microsoft has announced support for Silverlight on mobile devices with a limited initial support for Windows Mobile and the Nokia S60 models. You can learn more about this future support at http://www.microsoft.com/silverlight/overview/mobile.aspx.

What is Silverlight? Conclusion

In this lesson of the Silverlight tutorial, you
  • Explored Microsoft Silverlight at a high level.
  • Studied some of the history leading up to the release of Silverlight.
  • Investigated the architecture of Silverlight.
  • Learned which operating systems and browsers support Silverlight 2

What Features Are in Silverlight?

Silverlight combines multiple technologies into a single development platform that enables you to select the right tools and the right programming language for your needs. Silverlight offers the following features:
  • WPF and XAML. Silverlight includes a subset of the Windows Presentation Foundation (WPF) technology, which greatly extends the elements in the browser for creating UI. Silverlight lets you create immersive graphics, animation, media, and other rich client features, extending browser-based UI beyond what is available with HTML alone. Extensible Application Markup Language (XAML) provides a declarative markup syntax for creating elements. For more information, see Layout, Input, and Printing1, Graphics, Animation, and Media2, and Controls3.
  • Extensions to JavaScript. Silverlight provides extensions to the universal browser scripting language that provide control over the browser UI, including the ability to work with WPF elements. For more information, see JavaScript API for Silverlight4.
  • Cross-browser, cross-platform support. Silverlight runs the same on all popular browsers (and on popular platforms). You can design and develop your application without having to worry about which browser or platform your users have. For more information, see Supported Operating Systems and Browsers5.
  • Integration with existing applications. Silverlight integrates seamlessly with your existing JavaScript and ASP.NET AJAX code to complement functionality you have already created. For more information, see Integrating Silverlight with a Web Page6.
  • Access to the .NET Framework programming model. You can create Silverlight applications using dynamic languages such as IronPython as well as languages such as C# and Visual Basic. For more information, see Managed API for Silverlight7
  • Tools Support. You can use development tools, such as Visual Studio and Expression Blend, to quickly create Silverlight applications. For more information, see Silverlight Designer for Visual Studio 20108 and Expression Blend9.
  • Networking support. Silverlight includes support for HTTP over TCP. You can connect to WCF, SOAP, or ASP.NET AJAX services and receive XML, JSON, or RSS data. For more information, see Networking and Communication10. In addition, you can build multicast clients with Silverlight. For more information, see Working with Multicast11.
  • LINQ. Silverlight includes language-integrated query (LINQ), which enables you to program data access using intuitive native syntax and strongly typed objects in .NET Framework languages. For more information, see XML Data12.
For more details on Silverlight features, see Silverlight Architecture13

hat Is Silverlight?

Silverlight enables you to create a state-of-the-art application that has the following features:
  • It is a cross-browser, cross-platform technology. It runs in all popular Web browsers, including Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari, Google Chrome, and on Microsoft Windows and Apple Mac OS X.
  • It is supported by a small download that installs in seconds.
  • It streams video and audio. It scales video quality to everything from mobile devices to desktop browsers to 720p HDTV video modes.
  • It includes compelling graphics that users can manipulate—drag, turn, and zoom—directly in the browser.
  • It reads data and updates the display, but it doesn't interrupt the user by refreshing the whole page.
  • The application can run in the Web browser or you can configure it so users can run it on their computer (out-of-browser).

SilverLight Explanation

What is Silverlight?

Silverlight is a new cross-browser, cross-platform implementation of the .NET Framework for building and delivering the next generation of media experiences and Rich Interactive Applications(RIA) for the web. It runs in all popular browsers, including Microsoft Internet Explorer, Mozilla Firefox, Apple Safari, Opera. The plugin required to run Silverlight is very small in size hence gets installed very quickly.
It is combination of different technolgoies into a single development platform that allows you to select tools and the programming language you want to use. Silverlight integrates seamlessly with your existing Javascript and ASP.NET AJAX code to complement functionality which you have already created.
Silverlight aims to compete with Adobe Flash and the presentation components of Ajax. It also competes with Sun Microsystems' JavaFX, which was launched a few days after Silverlight.
Currently there are 2 major versions of Silverlight:
Silverlight 1.0 and Silverlight 2.0( previously referred to as version 1.1).

Silverlight 1.0 :

Silverlight 1.0 consists of the core presentation framework, which is responsible for UI, interactivity and user input, basic UI controls, graphics and animation, media playback, DRM support, and DOM integration.
Main features of Silverlight 1.0 :
  1. Built-in codec support for playing VC-1 and WMV video, and MP3 and WMA audio within a browser.
  2. Silverlight supports the ability to progressively download and play media content from any web-server.
  3. Silverlight also optionally supports built-in media streaming.
  4. Silverlight enables you to create rich UI and animations, and blend vector graphics with HTML to create compelling content experiences.
  5. Silverlight makes it easy to build rich video player interactive experiences.

Silverlight 2.0 :

Silverlight 2.0 includes a version of the .NET Framework, with the full Common Language Runtime as .NET Framework 3.0; so it can execute any .NET language including VB.NET and C# code. Unlike the CLR included with .NET Framework, multiple instances of the CoreCLR included in Silverlight can be hosted in one process. With this, the XAML layout markup file (.xaml file) can be augmented by code-behind code, written in any .NET language, which contains the programming logic.
This version ships with more than 30 UI controls(including TextBox, CheckBox, Slider, ScrollViewer, and Calendar controls), for two-way databinding support, automated layout management (by means of StackPanel, Grid etc) as well as data-manipulation controls, such as DataGrid and ListBox. UI controls are skinnable using a template-based approach.
Main features of Silverlight 2.0 :
  1. A built-in CLR engine that delivers a super high performance execution environment for the browser. Silverlight uses the same core CLR engine that we ship with the full .NET Framework.
  2. Silverlight includes a rich framework library of built-in classes that you can use to develop browser-based applications.
  3. Silverlight includes support for a WPF UI programming model. The Silverlight 1.1 Alpha enables you to program your UI with managed code/event handlers, and supports the ability to define and use encapsulated UI controls.
  4. Silverlight provides a managed HTML DOM API that enables you to program the HTML of a browser using any .NET language.
  5. Silverlight doesn't require ASP.NET to be used on the backend web-server (meaning you could use Silverlight with with PHP on Linux if you wanted to).
  6. Silverlight 2 includes Deep Zoom, a technology derived from Microsoft Live Labs Seadragon. It allows users to zoom into, or out of, an image (or a collage of images), with smooth transitions, using the mouse wheel. The images can scale from 2 or 3 megapixels in resolution into the gigapixel range, but the user need not wait for it to be downloaded entirely; rather, Silverlight downloads only the parts in view, optimized for the zoom level being viewed.
  7. Silverlight 2 also allows limited filesystem access to Silverlight applications. It can use the operating system's native file dialog box to browse to any file (to which the user has access).

 

How Silverlight would change the Web:

  1. Highest Quality Video Experience : prepare to see some of the best quality videos you have seen in your life, all embedded in highly graphical websites. The same research and technology that was used for VC-1, the codec that powers BluRay and HD DVD, is used by Microsoft today with its streaming media technologies.
  2. Cross-Platform, Cross-Browser : Finally build web applications that work on any browser, and on any operating system. At release, Silverlight will work with Mac as well as Windows!  The Mono project has also already promised support for Linux!.
  3. Developers and Graphic Designers can play together! : Developers familiar with Visual Studio, Microsoft.net will be able to develop amazing Silverlight applications very quickly, and they will work on Mac's and Windows. Developers will finally be able to strictly focus on the back end of the application core, while leaving the visuals to the Graphic Design team using the power of XAML.
  4. Cheaper : Silverlight is now the most inexpensive way to stream video files over the internet at the best quality possible. Licensing is dead simple, all you need is IIS in Windows Server, and you’re done.
  5. Support for 3rd Party Languages : Using the power of the new Dynamic Language Runtime, developers will now be able to use Ruby, Python, and EcmaScript! This means a Ruby developer can develop Silverlight applications, and leverage the .net Framework!
  6. Cross-Platform, Cross-Browser Remote Debugging : If you are in the need to debug an application running on a Mac, no problem! You can now set breakpoints, step into/over code, have immediate windows, and all that other good stuff that Visual Studio provides.
  7. The best development environment on the planet : Visual Studio is an award winning development platform! As it continues to constantly evolve, so will Silverlight!
  8. Silverlight offers copy protection : Have you noticed how easy it is to download YouTube videos to your computer, and save them for later viewing ? Silverlight will finally have the features enabling content providers complete control over their rich media content! Streaming television, new indie broadcast stations, all will now be possible!
  9. Extreme Speed :There is a dramatic improvement in speed for AJAX-enabled websites that begin to use Silverlight, leveraging the Microsoft .net framework.

Getting Started With SilverLight :

In order to create Silverlight applications with following :

Runtime :

Microsoft Silverlight 2.0 : The runtime required to view Silverlight applications created with .NET Microsoft.

Developer Tools :

Microsoft Visual Studio 8.0 : The next generation development tool.
Microsoft Silverlight Tools for Visual Studio 2008 : The add-on to create Silverlight applications with Visual Studio 2008. This install will also install the Silverlight Developer Runtime and the Silverlight SDK. This add-on works with all versions of Visual Studio 2008 Service Pack 1, including Visual Web Developer.

Designer Tools :

Download the Expression designer tools to start designing Silverlight application.
Expression Blend 2.5
The latest offering from Microsoft to create Silverlight content is Expression Blend 2.5 June 2008 Preview.

Software Development Kit:

Microsoft Silverlight Software Development Kit: Download this SDK to create Silverlight Web experiences that target Silverlight 2.0. The SDK contains documentation, tools, Silverlight ASP.NET controls and the libraries needed to build Silverlight applications.
Eclipse Tools for Silverlight :
An Open Source, feature-rich and professional RIA application development environment for Microsoft Silverlight in Eclipse.

ASP.NET AJAX Interview Questions

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.
Which is the current version of ASP.NET AJAX Control Toolkit?
As of this writing, the toolkit version is Version 1.0.20229 (if you are targeting Framework 2.0, ASP.NET AJAX 1.0 and Visual Studio 2005) and Version 3.0.20229 (if targeting .NET Framework 3.5 and Visual Studio 2008).
What role does the ScriptManager play?
The ScriptManager manages all ASP.NET AJAX resources on a page and renders the links for the ASP.NET AJAX client libraries, which lets you use AJAX functionality like PageMethods, UpdatePanels etc. It creates the PageRequestManager and Application objects, which are prominent in raising events during the client life cycle of an ASP.NET AJAX Web page. It also helps you create proxies to call web services asynchronously.
Can we use multiple ScriptManager on a page?
No. You can use only one ScriptManager on a page.
What is the role of a ScriptManagerProxy?
A page can contain only one ScriptManager control. If you have a Master-Content page scenario in your application and the MasterPage contains a ScriptManager control, then you can use the ScriptManagerProxy control to add scripts to content pages.
Also, if you come across a scenario where only a few pages in your application need to register to a script or a web service, then its best to remove them from the ScriptManager control and add them to individual pages, by using the ScriptManagerProxy control. That is because if you added the scripts using the ScriptManager on the Master Page, then these items will be downloaded on each page that derives from the MasterPage, even if they are not needed, which would lead to a waste of resources.
What are the requirements to run ASP.NET AJAX applications on a server?
You would need to install ‘ASP.NET AJAX Extensions’ on your server. If you are using the ASP.NET AJAX Control toolkit, then you would also need to add the AjaxControlToolkit.dll in the /Bin folder.
Note: ASP.NET AJAX 1.0 was available as a separate downloadable add-on for ASP.NET 2.0. With ASP.NET 3.5, the AJAX components have been integrated into ASP.NET.
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.
Can I use ASP.NET AJAX with any other technology apart from ASP.NET?
To answer this question, check out this example of using ASP.NET AJAX with PHP, to demonstrate running ASP.NET AJAX outside of ASP.NET. Client-Side ASP.NET AJAX framework can be used with PHP and Coldfusion.
How can you cancel an Asynchronous postback?
Yes you can. Read my article over here.
Difference between Server-Side AJAX framework and Client-side AJAX framework?
ASP.NET AJAX contains both a server-side Ajax framework and a client-side Ajax framework. The server-side framework provides developers with an easy way to implement Ajax functionality, without having to possess much knowledge of JavaScript. The framework includes server controls and components and the drag and drop functionality. This framework is usually preferred when you need to quickly ajaxify an asp.net application. The disadvantage is that you still need a round trip to the server to perform a client-side action.
The Client-Side Framework allows you to build web applications with rich user-interactivity as that of a desktop application. It contains a set of JavaScript libraries, which is independent from ASP.NET. The library is getting rich in functionality with every new build released.
 How can you debug ASP.NET AJAX applications?
Explain about two tools useful for debugging: Fiddler for IE and Firebug for Mozilla.
Can we call Server-Side code (C# or VB.NET code) from javascript?
Yes. You can do so using PageMethods in ASP.NET AJAX or using webservices.
Can you nest UpdatePanel within each other?
Yes, you can do that. You would want to nest update panels to basically have more control over the Page Refresh.
How can you to add JavaScript to a page when performing an asynchronous postback?
Use the ScriptManager class. This class contains several methods like the RegisterStartupScript(), RegisterClientScriptBlock(), RegisterClientScriptInclude(), RegisterArrayDeclaration(),RegisterClientScriptResource(), RegisterExpandoAttribute(), RegisterOnSubmitStatement() which helps to add javascript while performing an asynchronous postback.
Explain differences between the page execution lifecycle of an ASP.NET page and an ASP.NET AJAX page?
In an asynchronous model, all the server side events occur, as they do in a synchronous model. The Microsoft AJAX Library also raises client side events. However when the page is rendered, asynchronous postback renders only the contents of the update panel, where as in a synchronous postback, the entire page is recreated and sent back to the browser.
Explain the AJAX Client life-cycle events
Here’s a good article about the same.
Is the ASP.NET AJAX Control Toolkit(AjaxControlToolkit.dll) installed in the Global Assembly Cache?
No. You must copy the AjaxControlToolkit.dll assembly to the /Bin folder in your application.
 Those were some frequently asked questions you should have knowledge about. In one of the coming articles, we will cover some more ASP.NET AJAX FAQ’s which were not covered in this article. I hope this article was useful and I thank you for viewing it.

General .NET Interview Questions

What is an application server?
As defined in Wikipedia, an application server is a software engine that delivers applications to client computers or devices. The application server runs your server code. Some well known application servers are IIS (Microsoft), WebLogic Server (BEA), JBoss (Red Hat), WebSphere (IBM).
Compare C# and VB.NET
A detailed comparison can be found over here.
What is a base class and derived class?
A class is a template for creating an object. The class from which other classes derive fundamental functionality is called a base class. For e.g. If Class Y derives from Class X, then Class X is a base class.
 
The class which derives functionality from a base class is called a derived class. If Class Y derives from Class X, then Class Y is a derived class.
What is an extender class?
An extender class allows you to extend the functionality of an existing control. It is used in Windows forms applications to add properties to controls.
A demonstration of extender classes can be found over here.
What is inheritance?
Inheritance represents the relationship between two classes where one type derives functionality from a second type and then extends it by adding new methods, properties, events, fields and constants.
 
C# support two types of inheritance:
·         Implementation inheritance
·         Interface inheritance
What is implementation and interface inheritance?
When a class (type) is derived from another class(type) such that it inherits all the members of the base type it is Implementation Inheritance.
When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface Inheritance.
In general Classes can be derived from another class, hence support Implementation inheritance. At the same time Classes can also be derived from one or more interfaces. Hence they support Interface inheritance.
Source: Exforsys.
What is inheritance hierarchy?
The class which derives functionality from a base class is called a derived class. A derived class can also act as a base class for another class. Thus it is possible to create a tree-like structure that illustrates the relationship between all related classes. This structure is known as the inheritance hierarchy.
How do you prevent a class from being inherited?
In VB.NET you use the NotInheritable modifier to prevent programmers from using the class as a base class. In C#, use the sealed keyword.
When should you use inheritance?
Read this.
Define Overriding?
Overriding is a concept where a method in a derived class uses the same name, return type, and arguments as a method in its base class. In other words, if the derived class contains its own implementation of the method rather than using the method in the base class, the process is called overriding.
Can you use multiple inheritance in .NET?
.NET supports only single inheritance. However the purpose is accomplished using multiple interfaces.
Why don’t we have multiple inheritance in .NET?
There are several reasons for this. In simple words, the efforts are more, benefits are less. Different languages have different implementation requirements of multiple inheritance. So in order to implement multiple inheritance, we need to study the implementation aspects of all the languages that are CLR compliant and then implement a common methodology of implementing it. This is too much of efforts. Moreover multiple interface inheritance very much covers the benefits that multiple inheritance has.
What is an Interface?
An interface is a standard or contract that contains only the signatures of methods or events. The implementation is done in the class that inherits from this interface. Interfaces are primarily used to set a common standard or contract.
When should you use abstract class vs interface or What is the difference between an abstract class and interface?
I would suggest you to read this. There is a good comparison given over here.
What are events and delegates?
An event is a message sent by a control to notify the occurrence of an action. However it is not known which object receives the event. For this reason, .NET provides a special type called Delegate which acts as an intermediary between the sender object and receiver object.
What is business logic?
It is the functionality which handles the exchange of information between database and a user interface.
What is a component?
Component is a group of logically related classes and methods. A component is a class that implements the IComponent interface or uses a class that implements IComponent interface.
What is a control?
A control is a component that provides user-interface (UI) capabilities.
What are the differences between a control and a component?
The differences can be studied over here.
What are design patterns?
Design patterns are common solutions to common design problems.
What is a connection pool?
A connection pool is a ‘collection of connections’ which are shared between the clients requesting one. Once the connection is closed, it returns back to the pool. This allows the connections to be reused.
What is a flat file?
A flat file is the name given to text, which can be read or written only sequentially.
What are functional and non-functional requirements?
Functional requirements defines the behavior of a system whereas non-functional requirements specify how the system should behave; in other words they specify the quality requirements and judge the behavior of a system.
E.g.
Functional - Display a chart which shows the maximum number of products sold in a region.
Non-functional – The data presented in the chart must be updated every 5 minutes.
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 stack? What is a heap? Give the differences between the two?
Stack is a place in the memory where value types are stored. Heap is a place in the memory where the reference types are stored.
 
Check this link for the differences.
What is instrumentation?
It is the ability to monitor an application so that information about the application’s progress, performance and status can be captured and reported.
What is code review?
The process of  examining the source code generally through a peer, to verify it against best practices.
What is logging?
Logging is the process of persisting information about the status of an application.
What are mock-ups?
Mock-ups are a set of designs in the form of screens, diagrams, snapshots etc., that helps verify the design and acquire feedback about the application’s requirements and use cases, at an early stage of the design process.
What is a Form?
A form is a representation of any window displayed in your application. Form can be used to create standard, borderless, floating, modal windows.
What is a multiple-document interface(MDI)?
A user interface container that enables a user to work with more than one document at a time. E.g. Microsoft Excel.
What is a single-document interface (SDI) ?
A user interface that is created to manage graphical user interfaces and controls into single windows. E.g. Microsoft Word
What is BLOB ?
A BLOB (binary large object) is a large item such as an image or an exe  represented in binary form.
What is ClickOnce?
ClickOnce is a new deployment technology that allows you to create and publish self-updating applications that can be installed and run with minimal user interaction.
What is object role modeling (ORM) ?
It is a logical model for designing and querying database models. There are various ORM tools in the market like CaseTalk, Microsoft Visio for Enterprise Architects, Infagon etc.
What is a private assembly?
A private assembly is local to the installation directory of an application and is used only by that application.
What is a shared assembly?
A shared assembly is kept in the global assembly cache (GAC) and can be used by one or more applications on a machine.
What is the difference between user and custom controls?
User controls are easier to create whereas custom controls require extra effort.
User controls are used when the layout is static whereas custom controls are used in dynamic layouts.
A user control cannot be added to the toolbox whereas a custom control can be.
A separate copy of a user control is required in every application that uses it whereas since custom controls are stored in the GAC, only a single copy can be used by all applications.
Where do custom controls reside?
In the global assembly cache (GAC).
What is a third-party control ?
A third-party control is one that is not created by the owners of a project. They are usually used to save time and resources and reuse the functionality developed by others (third-party).
What is a binary formatter?
Binary formatter is used to serialize and deserialize an object in binary format.
What is Boxing/Unboxing?
Boxing is used to convert value types to object.
E.g. int x = 1;
object obj = x ;
Unboxing is used to convert the object back to the value type.
E.g. int y = (int)obj;
Boxing/unboxing is quiet an expensive operation.
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 a digital signature?
A digital signature is an electronic signature used to verify/gurantee the identity of the individual who is sending the message.
What is garbage collection?
Garbage collection is the process of managing the allocation and release of memory in your applications. Read this article for more information.
What is globalization?
Globalization is the process of customizing applications that support multiple cultures and regions.
What is localization?
Localization is the process of customizing applications that support a given culture and regions.
What is MIME?
The definition of MIME or Multipurpose Internet Mail Extensions as stated in MSDN is “MIME is a standard that can be used to include content of various types in a single message. MIME extends the Simple Mail Transfer Protocol (SMTP) format of mail messages to include multiple content, both textual and non-textual. Parts of the message may be images, audio, or text in different character sets. The MIME standard derives from RFCs such as 2821 and 2822”.

.NET Framework Interview Questions

What is the Microsoft.NET?
.NET is a set of technologies designed to transform the internet into a full scale distributed platform. It provides new ways of connecting systems, information and devices through a collection of web services. It also provides a language independent, consistent programming model across all tiers of an application.
The goal of the .NET platform is to simplify web development by providing all of the tools and technologies that one needs to build distributed web applications.
What is the .NET Framework?
The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft's managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.
The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.
What is CLR?
The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications.
What is CTS?
Common Type System (CTS) describes the datatypes that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross-language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.
What is CLS?
Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages.
What is managed code?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. The code that runs within the common language runtime is called managed code.
What is MSIL?
When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.
What is JIT?
JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.
Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.
What is portable executable (PE)?PE is the file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.
What is an application domain?
Application domain is the boundary within which an application runs. A process can contain multiple application domains. Application domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use a proxy.
How does an AppDomain get created? AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application. AppDomains can also be explicitly created by .NET applications.
What is an assembly?
An assembly is a collection of one or more .exe or dll’s. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations.
What are the contents of assembly?
A static assembly can consist of four elements:
·         Assembly manifest - Contains the assembly metadata. An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types and resources.
·         Type metadata - Binary information that describes a program.
·         Microsoft intermediate language (MSIL) code.
·         A set of resources.
What are the different types of assembly?
Assemblies can also be private or shared. A private assembly is installed in the installation directory of an application and is accessible to that application only. On the other hand, a shared assembly is shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.
We also have satellite assemblies that are often used to deploy language-specific resources for an application.
What is a dynamic assembly?
A dynamic assembly is created dynamically at run time when an application requires the types within these assemblies.
What is a strong name?
You need to assign a strong name to an assembly to place it in the GAC and make it globally accessible. A strong name consists of a name that consists of an assembly's identity (text name, version number, and culture information), a public key and a digital signature generated over the assembly.  The .NET Framework provides a tool called the Strong Name Tool (Sn.exe), which allows verification and key pair and signature generation.
What is GAC? What are the steps to create an assembly and add it to the GAC?
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
Steps
- Create a strong name using sn.exe tool eg: sn -k mykey.snk
- in AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile("mykey.snk")]
- recompile project, and then install it to GAC in two ways :
·         drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)
·         gacutil -i abc.dll
What is the caspol.exe tool used for?
The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels.
What is a garbage collector?
A garbage collector performs periodic checks on the managed heap to identify objects that are no longer required by the program and removes them from memory.
What are generations and how are they used by the garbage collector?
Generations are the division of objects on the managed heap used by the garbage collector. This mechanism allows the garbage collector to perform highly optimized garbage collection. The unreachable objects are placed in generation 0, the reachable objects are placed in generation 1, and the objects that survive the collection process are promoted to higher generations.
What is Ilasm.exe used for?
Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.
What is Ildasm.exe used for?
Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.
What is the ResGen.exe tool used for?
ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.