<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-866059043129217594</id><updated>2012-02-16T04:45:30.130-08:00</updated><category term='new1'/><category term='DotIntevriew preperation'/><category term='ASP.Net Page life Cycle'/><category term='ASP.Net InterView Questions'/><category term='GarbageCollection'/><category term='ado.net'/><category term='SQL Server Reporting Services'/><category term='SQL Server Interview Questions'/><category term='dotnet concets'/><category term='Secured String'/><title type='text'>Edging DotNet</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-827539033790793935</id><published>2008-10-10T21:01:00.000-07:00</published><updated>2008-10-10T21:03:11.138-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dotnet concets'/><title type='text'>dotnet concets</title><content type='html'>  &lt;p class="MsoNormal"&gt;&lt;span class="clstitle"&gt;&lt;i&gt;NET Remoting&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="clsblurb"&gt;Microsoft's .NET framework provides a way for a client in one application domain to access objects in another application domain; this is made possible through .NET Remoting. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;.NET Remoting is a very flexible technology that allows clients and servers to communicate with each other, no matter where they are located. The client and server can be on the same machine, on different machines on the same network, or in different countries across the world. .NET Remoting makes life easy by providing services and infrastructure components that hide all the complexities from application developers. &lt;/p&gt;  &lt;p&gt;.NET Remoting allows us to use different protocols, different serialization formats, configuration settings, etc. .NET Remoting even allows programmers to create and install their own "hooks" in the .NET Remoting pipeline in order to customize the default behavior of the remoting framework (Tracking Services is an example of such a hook) &lt;/p&gt;  &lt;p&gt;So how does .NET Remoting work? Well, some of the concepts behind .NET Remoting are borrowed from the old distributed technologies, such as DCOM, CORBA, etc. First of all, always remember that in .NET Remoting, objects are exposed to the outside world through some "Listener" process; that listener process could be a console application, a WinForm application, a Windows service, or even IIS. The listener process specifies the objects that are exposed programmatically or by using the .config file. Once that part is done, client applications connect to the listener process for object creation requests and the listener process then creates and returns the objects back to the client. All communication between client and server application domains is performed by sending and receiving encoded streams of data over some channel. &lt;/p&gt;  &lt;p&gt;&lt;span class="clstitle"&gt;Channels&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="clsblurb"&gt;The basic purpose of channels is to transport data from one end point to another; .NET comes with two built-in channels, HTTP channel (&lt;i&gt;System.Runtime.Remoting.Channels.Http&lt;/i&gt;) and TCP channel (&lt;i&gt;System.Runtime.Remoting.Channels.Tcp&lt;/i&gt;). &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;TCP channel is faster than HTTP channel, and it is good for binary data; whereas HTTP channel is very good when it comes to firewalls and the Internet. You are not limited to these channels; you can create your own custom channels and plug them into .NET Remoting. &lt;/p&gt;  &lt;p&gt;&lt;span class="clstitle"&gt;Formatters&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="clsblurb"&gt;Formatters, as the name implies, format data or messages for delivery. Once data/message has been formatted, it is transported to other application domains by using the appropriate channel. .NET comes with two built-in formatters, Soap formatter (&lt;i&gt;System.Runtime.Serialization.Formatters.Soap&lt;/i&gt;) and Binary formatter (&lt;i&gt;System.Runtime.Serialization.Formatters.Binary&lt;/i&gt;). &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;Soap formatter formats message in Soap 1.1 specification, whereas Binary formatter formats message in pure binary form. &lt;/p&gt;  &lt;p&gt;&lt;span class="clstitle"&gt;Types of Remoting Objects&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="clsblurb"&gt;There are two types of objects supported by .NET Remoting: server-activated objects (also known as &lt;b&gt;well-known&lt;/b&gt; objects) and client-activated objects. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Server-activated objects&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;Server-activated objects, as the name implies, are created by the server and their lifetime is also managed by the server. The point to catch here is that these objects are not created when a client calls &lt;b&gt;New&lt;/b&gt; or &lt;b&gt;Activator.GetObject&lt;/b&gt;; rather, the actual instance of the object is created when the client actually invokes a method on proxy. &lt;/p&gt;  &lt;p&gt;There is one implication to the above mentioned behavior. Since the object is not created at the time the client calls the &lt;b&gt;New&lt;/b&gt; or &lt;b&gt;Activator.GetObject&lt;/b&gt; method, we cannot use non-default constructors with server-activated objects. Only default constructors (constructors with no parameters) are supported for such objects. &lt;/p&gt;  &lt;p&gt;There are two modes in which server-activated objects can be activated: &lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Singleton&lt;/b&gt;&lt;br /&gt;     Only one object will be created on the server to fulfill the requests of      all the clients; that means the object is shared, and the state will be      shared by all the clients. &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;SingleCall&lt;/b&gt;&lt;br /&gt;     Such objects are created on each method call and objects are not shared      among clients. State should not be maintained in such objects because such      objects are destroyed after each method call. &lt;/li&gt;&lt;/ul&gt;  &lt;p style="margin-left: 0.5in;"&gt;&lt;b&gt;Client-activated objects&lt;/b&gt; &lt;/p&gt;  &lt;p style="margin-left: 0.5in;"&gt;Client-activated objects are created by the server and their lifetime is managed by the client. In contrast to server-activated objects, client-activated objects are created as soon as the client calls &lt;b&gt;New&lt;/b&gt; or any other object creation method; therefore, we can use both the default and non-default constructors with client-activated objects. Client-activated objects are specific to the client, and objects are not shared among different clients; object instance exists until the lease expires or the client destroys the object. &lt;/p&gt;  &lt;p style="margin-left: 0.5in;"&gt;&lt;span class="clstitle"&gt;Configuration&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left: 0.5in;"&gt;&lt;span class="clsblurb"&gt;Like other .NET technologies, .NET Remoting also needs some configuration information in order to work. We can configure our remoting application either programmatically or by using a .config file. For this article, we will discuss .config files. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left: 0.5in;"&gt;.NET Remoting configuration settings are packed in the &lt;&lt;b&gt;application&lt;/b&gt;&gt; tag in the following XML format: &lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;application&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/application&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/System.Runtime.Remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;/configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style=""&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;span class="clsblurb"&gt;In order to expose server-activated objects, we use the &lt;&lt;b&gt;service&lt;/b&gt;&gt; tag, as shown in the example below: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt; &lt;system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;application&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;service&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;wellknown mode="SingleCall" type="MyObjects.Customer, MyObjects"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;objectUri="Customer"/&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/service&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;channel ref="tcp" port="1234"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/application&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt; &lt;/system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;/configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style=""&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;span class="clsblurb"&gt;The above configuration specifies that we are exposing a &lt;i&gt;SingleCall&lt;/i&gt; object whose complete type name is MyObjects.Customer. The class is contained in the &lt;i&gt;MyObjects.DLL&lt;/i&gt; assembly; the object's URI is &lt;i&gt;Customer&lt;/i&gt;, and the object is accessible through TCP channel on port 1234. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left: 0.5in;"&gt;Each server-activated object will have its own &lt;&lt;b&gt;wellknown&lt;/b&gt;&gt; tag. &lt;/p&gt;  &lt;p style="margin-left: 0.5in;"&gt;The corresponding client-side .config file would be as follows: &lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt; &lt;system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;application name="MyClient"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;client&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;wellknown type="MyObjects.Customer,MyObjects"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;      &lt;/span&gt;url="tcp://localhost:1234/Customer"/&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/client&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;channel ref="tcp"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/application&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt; &lt;/system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;/configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style=""&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;span class="clsblurb"&gt;The client-side configuration file is slightly different from the server configuration file. We are using the &lt;&lt;b&gt;client&lt;/b&gt;&gt; tag instead of the &lt;&lt;b&gt;service&lt;/b&gt;&gt; tag; similarly we are using the &lt;b&gt;url&lt;/b&gt; attribute in the &lt;&lt;b&gt;wellknown&lt;/b&gt;&gt; tag on the client-side to specify the exact location of the server object. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left: 0.5in;"&gt;For client-activated objects, we use the &lt;&lt;b&gt;activated&lt;/b&gt;&gt; tag (both on sever and the client), instead of the &lt;&lt;b&gt;wellknown&lt;/b&gt;&gt; tag. Following example shows how to expose a client-activated object. &lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;application name="Data"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;service&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;activated type="MyObjects.Customer,MyObjects"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/service&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;channel ref="tcp" port="1234"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/application&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt; &lt;/system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;/configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style=""&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;span class="clsblurb"&gt;The corresponding client-side configuration file would look as follows: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt; &lt;system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;application name="Data"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;client url="tcp://localhost:1234/Data"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;!-- You can only use one url @ a time --&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;activated type="MyObjects.Customer,MyObjects"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/client&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;channel ref="tcp"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/channels&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/application&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt; &lt;/system.runtime.remoting&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="color: blue;"&gt;&lt;/configuration&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style=""&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What’s a Windows process?&lt;br /&gt;&lt;/b&gt;It’s an application that’s running and had been allocated memory.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What’s typical about a Windows process in regards to memory allocation?&lt;br /&gt;&lt;/b&gt;Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;Explain what relationship is between a Process, Application Domain, and Application?&lt;br /&gt;&lt;/b&gt;A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.&lt;br /&gt;   &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What are possible implementations of distributed applications in .NET?&lt;br /&gt;&lt;/b&gt;.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;strong&gt;What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?&lt;/strong&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process.  Web Services provide an open-protocol-based exchange of informaion.  Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.&lt;br /&gt;   &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What’s a proxy of the server object in .NET Remoting?&lt;br /&gt;&lt;/b&gt;It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as &lt;b&gt;marshaling&lt;/b&gt;.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What are remotable objects in .NET Remoting?&lt;br /&gt;&lt;/b&gt;Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What are channels in .NET Remoting?&lt;br /&gt;&lt;/b&gt;Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What security measures exist for .NET Remoting in System.Runtime.Remoting?&lt;br /&gt;&lt;/b&gt;None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What is a formatter?&lt;br /&gt;&lt;/b&gt;A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?&lt;br /&gt;&lt;/b&gt;Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What’s SingleCall activation mode used for?&lt;br /&gt;&lt;/b&gt;If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;What’s Singleton activation mode?&lt;br /&gt;&lt;/b&gt;A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;How do you define the lease of the object?&lt;br /&gt;&lt;/b&gt;By implementing ILease interface when writing the class code.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;Can you configure a .NET Remoting object via XML file?&lt;br /&gt;&lt;/b&gt;Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.&lt;br /&gt;  &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;How can you automatically generate interface for the remotable object in .NET with Microsoft tools?&lt;br /&gt;&lt;/b&gt;Use the Soapsuds tool.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;h1&gt;State Management in ASP.Net&lt;/h1&gt;  &lt;p class="articletext"&gt;Web Pages developed in ASP.Net are HTTP based and HTTP protocol is a stateless protocol. It means that web server does not have any idea about the requests from where they coming i.e from same client or new clients. On each request web pages are created and destroyed.&lt;/p&gt;  &lt;p&gt;So, how do we make web pages in ASP.Net which will remember about the user, would be able to distinguish b/w old clients(requests) and new clients(requests) and users previous filled information while navigating to other web pages in web site?&lt;/p&gt;  &lt;p class="articletext"&gt;Solution of the above problem lies in State Management.&lt;/p&gt;  &lt;p class="articletext"&gt;ASP.Net technology offers following state management techniques.&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;strong&gt;Client side State Management &lt;/strong&gt;&lt;/p&gt;  &lt;p class="articletext" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;o&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Cookies&lt;/p&gt;  &lt;p class="articletext" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;o&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Hidden Fields&lt;/p&gt;  &lt;p class="articletext" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;o&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;View State&lt;/p&gt;  &lt;p class="articletext" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;o&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Query String &lt;/p&gt;  &lt;p class="articletext"&gt;&lt;strong&gt;Server side State Management &lt;/strong&gt;&lt;/p&gt;  &lt;p class="articletext" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;o&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Session State&lt;/p&gt;  &lt;p class="articletext" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;o&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;Application State &lt;/p&gt;  &lt;p class="articletext"&gt;These state management techniques can be understood and by following simple examples and illustrations of the each techniques.&lt;/p&gt;  &lt;h1&gt;Client Side State Management&lt;/h1&gt;  &lt;h2&gt;Cookies&lt;/h2&gt;  &lt;p class="articletext"&gt;A cookie is a small amount of data which is either stored at client side in text file or in memory of the client browser session. Cookies are always sent with the request to the web server and information can be retrieved from the cookies at the web server. In ASP.Net, HttpRequest object contains cookies collection which is nothing but list of HttpCookie objects. Cookies are generally used for tracking the user/request in ASP.Net for example, ASP.Net internally uses cookie to store session identifier to know whether request is coming from same client or not. We can also store some information like user identifier (UserName/Nick Name etc) in the cookies and retrieve them when any request is made to the web server as described in following example. It should be noted that cookies are generally used for storing only small amount of data(i.e 1-10 KB).&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;i&gt;Code Sample&lt;/i&gt;&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;//Storing value in cookie &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;HttpCookie cookie = new HttpCookie("NickName");&lt;br /&gt;cookie.Value = "David";&lt;br /&gt;Request.Cookies.Add(cookie);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;//Retrieving value in cookie &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;if (Request.Cookies.Count &gt; 0 &amp;amp;&amp;amp; Request.Cookies["NickName"] != null)&lt;br /&gt;         lblNickName.Text = "Welcome" + Request.Cookies["NickName"].ToString();&lt;br /&gt;else&lt;br /&gt;         lblNickName.Text = "Welcome Guest"; &lt;/span&gt;&lt;/p&gt;  &lt;p class="articletext"&gt; Cookies can be permanent in nature or temporary. ASP.Net internally stores temporary cookie at the client side for storing session identifier. By default cookies are temporary and permanent cookie can be placed by setting "Expires" property of the cookie object.&lt;/p&gt;  &lt;h2&gt;Hidden Fields&lt;/h2&gt;  &lt;p class="articletext"&gt;&lt;br /&gt;&lt;br /&gt;A Hidden control is the control which does not render anything on the web page at client browser but can be used to store some information on the web page which can be used on the page.&lt;/p&gt;  &lt;p class="articletext"&gt;HTML input control offers hidden type of control by specifying type as "hidden". Hidden control behaves like a normal control except that it is not rendered on the page. Its properties can be specified in a similar manner as you specify properties for other controls. This control will be posted to server in HttpControl collection whenever web form/page is posted to server. Any page specific information can be stored in the hidden field by specifying value property of the control.&lt;/p&gt;  &lt;p class="articletext"&gt;ASP.Net provides HtmlInputControl that offers hidden field functionality.&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;i&gt;Code Sample&lt;/i&gt;&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;span style="color: green;"&gt;//Declaring a hidden variable&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;br /&gt;protected HtmlInputHidden hidNickName;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;//Populating hidden variable&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;hidNickName.Value = "Page No 1";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;//Retrieving value stored in hidden field.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;string str = hidNickName.Value;&lt;/span&gt; &lt;/p&gt;  &lt;p class="articletext"&gt;&lt;b&gt;Note:&lt;/b&gt;Critical information should not be stored in hidden fields.&lt;/p&gt;  &lt;h2&gt;View State/Control State&lt;/h2&gt;  &lt;p class="articletext"&gt;ASP.Net technology provides View State/Control State feature to the web forms. View State is used to remember controls state when page is posted back to server. ASP.Net stores view state on client site in hidden field __ViewState in encrypted form. When page is created on web sever this hidden control is populate with state of the controls and when page is posted back to server this information is retrieved and assigned to controls. You can look at this field by looking at the source of the page (i.e by right clicking on page and selecting view source option.)&lt;/p&gt;  &lt;p class="articletext"&gt;You do not need to worry about this as this is automatically handled by ASP.Net. You can enable and disable view state behaviour of page and its control by specifying 'enableViewState' property to true and false. You can also store custom information in the view state as described in following code sample. This information can be used in round trips to the web server.&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;i&gt;Code Sample&lt;/i&gt;&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;span style="color: green;"&gt;//To Save Information in View State&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;br /&gt;ViewState.Add ("NickName", "David");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;//Retrieving View state&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;String strNickName = ViewState ["NickName"];&lt;/span&gt;&lt;/p&gt;  &lt;h2&gt;Query String&lt;/h2&gt;  &lt;p class="articletext"&gt;Query string is the limited way to pass information to the web server while navigating from one page to another page. This information is passed in url of the request.  Following is an example of retrieving information from the query strings.&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;i&gt;Code Sample&lt;/i&gt;&lt;/p&gt;  &lt;p class="articletext" style="margin-bottom: 12pt;"&gt;&lt;span style="color: green;"&gt;//Retrieving values from query string&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;br /&gt;String nickname;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;//Retrieving from query string&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;nickName = Request.Param["NickName"].ToString();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But remember that many browsers impose a limit of 255 characters in query strings. You need to use HTTP-Get method to post a page to server otherwise query string values will not be available.&lt;/p&gt;  &lt;h1&gt;Server Side State Management&lt;/h1&gt;  &lt;h2&gt;Session State&lt;/h2&gt;  &lt;p class="articletext"&gt;Session state is used to store and retrieve information about the user as user navigates from one page to another page in ASP.Net web application. Session state is maintained per user basis in ASPNet runtime. It can be of two types in-memory and out of memory. In most of the cases small web applications in-memory session state is used. Out of process session state management technique is used for the high traffic web applications or large applications. It can be configured  with some configuration settings in web.conig file to store state information in ASPNetState.exe (windows service exposed in .Net or on SQL server.&lt;/p&gt;  &lt;p class="articletext"&gt;In-memory Session state can be used in following manner&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;i&gt;Code Sample&lt;/i&gt;&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;span style="color: green;"&gt;//Storing informaton in session state&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;br /&gt;Session["NickName"] = "Ambuj";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;//Retrieving information from session state&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;string str = Session["NickName"];&lt;/span&gt; &lt;/p&gt;  &lt;p class="articletext"&gt;Session state is being maintained automatically by ASP.Net. A new session is started when a new user sents  first request to the server. At that time session state is created and user can use it to store information and retrieve it while navigating to different web pages in ASP.Net web application.&lt;/p&gt;  &lt;p class="articletext"&gt;ASP.Net maintains session information using the session identifier which is being transacted b/w user machine and web server on each and every request either using cookies or querystring (if cookieless session is used in web application).&lt;/p&gt;  &lt;h2&gt;Application State&lt;/h2&gt;  &lt;p class="articletext"&gt;Application State is used to store information which is shared among users of the ASP.Net web application. Application state is stored in the memory of the windows process which is processing user requests on the web server. Application state is useful in storing small amount of often-used data. If application state is used for such data instead of frequent trips to database, then it increases the response time/performance of the web application.&lt;/p&gt;  &lt;p class="articletext"&gt;In ASP.Net, application state is an instance of HttpApplicationState class and it exposes key-value pairs to store information. Its instance is automatically created when a first request is made to web application by any user and same state object is being shared across all subsequent users.&lt;/p&gt;  &lt;p class="articletext"&gt;Application state can be used in similar manner as session state but it should be noted that many user might be accessing application state simultaneously so any call to application state object needs to be thread safe. This can be easily achieved in ASP.Net by using lock keyword on the statements which are accessing application state object. This lock keyword places a mutually exclusive lock on the statements and only allows a single thread to access the application state at a time. Following is an example of using application state in an application.&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;i&gt;Code Sample&lt;/i&gt;&lt;/p&gt;  &lt;p class="articletext"&gt;&lt;span style="color: green;"&gt;//Stroing information in application state&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;lock (this)&lt;br /&gt;{&lt;br /&gt;       Application["NickName"] = "David";&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;//Retrieving value from application state&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;lock (this)&lt;br /&gt;{&lt;br /&gt;      string str = Application["NickName"].ToString();&lt;br /&gt;} &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;h2&gt;Using ASP.NET Session State&lt;/h2&gt;  &lt;p&gt;Session state settings in ASP.NET are configured through the ASP.NET XML configuration file &lt;b&gt;config.web&lt;/b&gt;. We'll look at &lt;b&gt;config.web&lt;/b&gt; in more detail in a later column, but for this discussion of session state let's look at it briefly.&lt;/p&gt;  &lt;h3&gt;Config.web&lt;/h3&gt;  &lt;p&gt;There are two types of configuration files: a machine configuration file and an application configuration file, both named &lt;b&gt;config.web&lt;/b&gt;. The two are identical, except that the machine configuration file applies settings to all applications but the application configuration files are either restrictive or expansive on an application-by-application basis.&lt;/p&gt;  &lt;p&gt;In Beta 1, the machine &lt;b&gt;config.web&lt;/b&gt; file is in the &lt;b&gt;WinNT\Microsoft.NET\Framework\v1.0.2204&lt;/b&gt; directory, while the optional application configuration files exist in the application's directory. Application &lt;b&gt;config.web&lt;/b&gt; files are optional in the sense that if an application &lt;b&gt;config.web&lt;/b&gt; file doesn't exist, the machine &lt;b&gt;config.web &lt;/b&gt;settings are used instead. ASP.NET session state settings can be made in the machine &lt;b&gt;config.web&lt;/b&gt; file and overridden in a particular application's &lt;b&gt;config.web&lt;/b&gt; file.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Changes made to &lt;b&gt;config.web&lt;/b&gt; are applied immediately, unlike classic ASP, where the server has to be stopped and started for settings to take affect.&lt;/p&gt;  &lt;h3&gt;Session configuration&lt;/h3&gt;  &lt;p&gt;Below is a sample &lt;b&gt;config.web&lt;/b&gt; file used to configure the session state settings for an ASP.NET application:&lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl03');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;    &lt;v:stroke joinstyle="miter"&gt;    &lt;v:formulas&gt;     &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;     &lt;v:f eqn="sum @0 1 0"&gt;     &lt;v:f eqn="sum 0 0 @1"&gt;     &lt;v:f eqn="prod @2 1 2"&gt;     &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;     &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;     &lt;v:f eqn="sum @0 0 1"&gt;     &lt;v:f eqn="prod @6 1 2"&gt;     &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;     &lt;v:f eqn="sum @8 21600 0"&gt;     &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;     &lt;v:f eqn="sum @10 21600 0"&gt;    &lt;/v:formulas&gt;    &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;    &lt;o:lock ext="edit" aspectratio="t"&gt;   &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1025" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl03');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image002.gif" shapes="_x0000_i1025" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;&lt;configuration&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;sessionstate&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;mode="inproc"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;cookieless="false" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;timeout="20" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;sqlconnectionstring="data source=127.0.0.1;user id=&lt;user&gt;;password=&lt;password&gt;"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;server="127.0.0.1" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;port="42424" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;/&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/configuration&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The settings above are used to configure ASP.NET session state. Let's look at each in more detail and cover the various uses afterward. &lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Mode.&lt;/b&gt; The mode      setting supports three options: inproc, sqlserver, and stateserver. As      stated earlier, ASP.NET supports two modes: in process and out of process.      There are also two options for out-of-process state management: memory      based (stateserver), and SQL Server based (sqlserver). We'll discuss      implementing these options shortly.&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Cookieless.&lt;/b&gt; The      cookieless option for ASP.NET is configured with this simple Boolean      setting. &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Timeout.&lt;/b&gt; This option      controls the length of time a session is considered valid. The session      timeout is a sliding value; on each request the timeout period is set to      the current time plus the timeout value &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Sqlconnectionstring.&lt;/b&gt;      The sqlconnectionstring identifies the database connection string that      names the database used for mode sqlserver.&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Server.&lt;/b&gt; In the      out-of-process mode stateserver, it names the server that is running the      required Windows NT service: ASPState.&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Port.&lt;/b&gt; The port      setting, which accompanies the server setting, identifies the port number      that corresponds to the server setting for mode stateserver.&lt;/li&gt;&lt;/ul&gt;  &lt;h3&gt;Sample session state application&lt;/h3&gt;  &lt;p&gt;Before we use session state, we need an application to test it with. Below is the code for a simple Visual Basic® application that writes to and reads from session state, &lt;b&gt;SessionState.aspx&lt;/b&gt;:&lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl04');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1026" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl04');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image003.gif" shapes="_x0000_i1026" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;&lt;script runat="server"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;Sub Session_Add(sender As Object, e As EventArgs)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;     &lt;/span&gt;Session("MySession") = text1.Value&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;     &lt;/span&gt;span1.InnerHtml = "Session data updated! &lt;p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;                        &lt;/span&gt;Your session contains: &lt;span style="color:red;"&gt;" +&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;                        &lt;/span&gt;Session("MySession").ToString() + "&lt;/span&gt;"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;End Sub&lt;/pre&gt;&lt;pre&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;Sub CheckSession(sender As Object, e As EventArgs)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;If (Session("MySession") = Isnull) Then&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;span1.InnerHtml = "NOTHING, SESSION DATA LOST!"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;Else&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;span1.InnerHtml = "Your session contains: &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;                  &lt;/span&gt;&lt;span style=""&gt;       &lt;/span&gt;&lt;span style="color:red;"&gt;" +&lt;span style=""&gt;             &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;                         &lt;/span&gt;Session("MySession").ToString() + "&lt;/span&gt;"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;End If&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;End Sub&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;form runat="server"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;input id="text1" type="text" runat="server"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;input type="submit" runat="server"&gt;&lt;pre&gt;&lt;span style=""&gt;              &lt;/span&gt;OnServerClick="Session_Add" Value="Add to Session State"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;input type="submit" runat="server"&gt;&lt;pre&gt;&lt;span style=""&gt;              &lt;/span&gt;OnServerClick="CheckSession" Value="View Session State"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;hr size="1"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size:6;"&gt;&lt;span id="span1" runat="server/"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;This simple page wires up two server-side events for the &lt;b&gt;Add&lt;/b&gt; and &lt;b&gt;View&lt;/b&gt; buttons, and simply sets the session state to the value in the text box.&lt;/p&gt;  &lt;p&gt;There are four general configuration settings we can look at in more detail: in-process mode, out-of-process mode, SQL Server mode, and Cookieless.&lt;/p&gt;  &lt;h2&gt;In-process Mode&lt;/h2&gt;  &lt;p&gt;In-process mode simply means using ASP.NET session state in a similar manner to classic ASP session state. That is, session state is managed in process and if the process is re-cycled, state is lost. Given the new settings that ASP.NET provides, you might wonder why you would ever use this mode. The reasoning is quite simple: performance. The performance of session state, e.g. the time it takes to read from and write to the session state dictionary, will be much faster when the memory read to and from is in process, as cross-process calls add overhead when data is marshaled back and forth or possibly read from SQL Server.&lt;/p&gt;  &lt;p&gt;In-process mode is the default setting for ASP.NET. When this setting is used, the only other session &lt;b&gt;config.web&lt;/b&gt; settings used are cookieless and timeout. &lt;/p&gt;  &lt;p&gt;If we call &lt;b&gt;SessionState.aspx&lt;/b&gt;, set a session state value, and stop and start the ASP.NET process (iisreset), the value set before the process was cycled will be lost.&lt;/p&gt;  &lt;h2&gt;Out-of-process Mode&lt;/h2&gt;  &lt;p&gt;Included with the .NET SDK is a Windows® NT service: ASPState. This Windows service is what ASP.NET uses for out-of-process session state management. To use this state manager, you first need to start the service. To start the service, open a command prompt and type:&lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl05');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1027" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl05');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image004.gif" shapes="_x0000_i1027" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;net start aspstate&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;What you'll see is:&lt;/p&gt;  &lt;p class="fig"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1028" type="#_x0000_t75" alt="" style="'width:381pt;height:67.5pt'"&gt;  &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image005.gif" href="http://i.msdn.microsoft.com/ms972429.asp12282000-1%28en-us,MSDN.10%29.gif"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image005.gif" shapes="_x0000_i1028" border="0" height="90" width="508" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="label"&gt;&lt;b&gt;Figure 1. Starting the Windows NT service ASPState at the command prompt&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;At this point, the Windows NT Service ASPState has started and is available to ASP.NET. Next, we need to configure ASP.NET to take advantage of this service. To do this we need to configure &lt;b&gt;config.web&lt;/b&gt;:&lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl06');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1029" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl06');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image006.gif" shapes="_x0000_i1029" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;&lt;configuration&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;sessionstate&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;mode="stateserver"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;cookieless="false" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;timeout="20" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;sqlconnectionstring="data source=127.0.0.1;user id=&lt;user&gt;;password=&lt;password&gt;"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;server="127.0.0.1" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;port="42424" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;/&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/configuration&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;We changed only from &lt;code&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;inproc&lt;/span&gt;&lt;/code&gt; mode to &lt;code&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;stateserver mode&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;. This setting tells ASP.NET to look for the ASP state service on the server specified in the &lt;code&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;server&lt;/span&gt;&lt;/b&gt;&lt;/code&gt; and &lt;code&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;port&lt;/span&gt;&lt;/b&gt;&lt;/code&gt; settings—in this case, the local server.&lt;/p&gt;  &lt;p&gt;We can now call &lt;b&gt;SessionState.aspx&lt;/b&gt;, set a session state value, stop and start the IIS process (iisreset), and continue to have access to the values for our current state.&lt;/p&gt;  &lt;h2&gt;SQL Server Mode&lt;/h2&gt;  &lt;p&gt;The SQL Server mode option is similar to that of the Windows NT Service, except that the information persists to SQL Server rather than being stored in memory.&lt;/p&gt;  &lt;p&gt;To use SQL Server as our session state store, we first must create the necessary tables and stored procedures that ASP.NET will look for on the identified SQL Server. The .NET SDK provides us with a SQL script (&lt;b&gt;state.sql&lt;/b&gt;) to do just that.&lt;/p&gt;  &lt;h3&gt;state.sql&lt;/h3&gt;  &lt;p&gt;The &lt;b&gt;state.sql&lt;/b&gt; file contains the SQL commands used to create the ASPState database. This script creates two tables and several stored procedures. ASP.NET uses both the tables and the procedures to store data in SQL Server. I would recommend reading through &lt;b&gt;state.sql&lt;/b&gt; to learn more about what it is doing.&lt;/p&gt;  &lt;p&gt;The state.sql file can be found in &lt;b&gt;[system drive]\winnt\Microsoft.NET\Framework\[version]\&lt;/b&gt;&lt;/p&gt;  &lt;h3&gt;Applying the state.sql script&lt;/h3&gt;  &lt;p&gt;To apply the &lt;b&gt;state.sql&lt;/b&gt; script, use the command line tool SQL Server provides: &lt;b&gt;osql.exe&lt;/b&gt;. Using an sa equivalent SQL user, the syntax below is used:&lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl07');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1030" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl07');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image007.gif" shapes="_x0000_i1030" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;osql –S [server name] –U [user] –P [password] &lt;state.sql&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;i&gt; &lt;/i&gt;&lt;/b&gt;A lightweight version of SQL Server is installed when the .NET SDK is installed.&lt;/p&gt;  &lt;p&gt;Here's what you should see:&lt;/p&gt;  &lt;p class="fig"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1031" type="#_x0000_t75" alt="" style="'width:381pt;height:212.25pt'"&gt;  &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image008.gif" href="http://i.msdn.microsoft.com/ms972429.asp12282000-2%28en-us,MSDN.10%29.gif"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image008.gif" shapes="_x0000_i1031" border="0" height="283" width="508" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="label"&gt;&lt;b&gt;Figure 2. Using the SQL Server command line tool to apply state.sql script&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;After running osql, start and stop SQL Server; part of what &lt;b&gt;state.sql&lt;/b&gt; added were some start-up stored procedures that need to be run. Next, modify the configuration settings to set the mode to &lt;code&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;sqlserver&lt;/span&gt;&lt;/code&gt; and modify the &lt;code&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;sqlconnectionstring&lt;/span&gt;&lt;/code&gt; to identify the appropriate SQL Server serving the ASPState database. For example:&lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl08');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1032" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl08');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image009.gif" shapes="_x0000_i1032" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;&lt;configuration&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;sessionstate&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;mode="sqlserver"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;cookieless="false" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;timeout="20" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;sqlconnectionstring="data source=MySqlServer;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;                           &lt;/span&gt;user id=ASPState;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;                           &lt;/span&gt;password=1Gr8State"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;server="127.0.0.1" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;port="42424" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;/&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/configuration&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Again, similar to the Windows NT service state manager, we can now call &lt;b&gt;SessionState.aspx&lt;/b&gt;, set a session state value, stop and start the IIS process (iisreset), and continue to have access to the values for our current state. In fact, we could cluster the SQL Servers such that if one SQL Server happened to be unavailable, another server that was replicating its data could take its place. This provides a level of reliability that was not available in ASP.&lt;/p&gt;  &lt;h2&gt;Cookieless State&lt;/h2&gt;  &lt;p&gt;The last new feature that we can configure for ASP.NET session state is cookieless session state. Essentially this feature allows sites whose clients choose not to use cookies to take advantage of ASP.NET session state. &lt;/p&gt;  &lt;p&gt;This is done by modifying the URL with an ID that uniquely identifies the session: &lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl09');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1033" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl09');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image010.gif" shapes="_x0000_i1033" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;http://localhost/(lit3py55t21z5v55vlm25s55)/Application/SessionState.aspx&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;ASP.NET will modify relative links found within the page and embed this ID. Thus, as long as the user follows the path of links the site provides, session state can be maintained. However, if the end user re-writes the URL, the session state instance will most likely be lost.&lt;/p&gt;  &lt;p&gt;The IIS 4.0 Resource Kit provided a similar feature. It was implemented as an ISAPI filter that could modify the incoming and outgoing byte stream to write and read the necessary information. The difference between this and the ASP.NET feature is the effort required to use the feature. In ASP.NET, it's simply a matter of flipping a Boolean value in the &lt;b&gt;config.web&lt;/b&gt; file:&lt;/p&gt;  &lt;table style="" border="0" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in;"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl10');"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1034" type="#_x0000_t75" alt="" href="javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl10');" style="'width:7.5pt;" button="t"&gt;    &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image001.gif" href="http://i.msdn.microsoft.com/platform/Controls/CodeSnippet/resources/copy_off.gif"&gt;   &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image011.gif" shapes="_x0000_i1034" align="middle" border="0" height="9" width="10" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;Copy Code&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;"&gt;&lt;pre&gt;&lt;configuration&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;sessionstate&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;mode="stateserver"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;cookieless="true" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;timeout="20" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;sqlconnectionstring="data source=127.0.0.1;user id=&lt;user&gt;;password=&lt;password&gt;"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;server="127.0.0.1" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;      &lt;/span&gt;port="42424" &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;/&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/configuration&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Once cookieless is set to true, ASP.NET will do the work necessary to enable cookieless session state. Also note that all modes are supported for cookieless sessions.&lt;/p&gt;  &lt;h2&gt;Performance and Reliability Considerations&lt;/h2&gt;  &lt;p&gt;It's worth mentioning, briefly, some of the performance and reliability issues you should consider when using ASP.NET session state modes. &lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;In process.&lt;/b&gt; In process      will perform best because the session state memory is kept within the      ASP.NET process. For Web applications hosted on a single server,      applications in which the user is guaranteed to be re-directed to the      correct server, or when session state data is not critical (in the sense      that it can be re-constructed or re-populated), this is the mode to      choose.&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Out of process.&lt;/b&gt; This      mode is best used when performance is important but you can't guarantee      which server a user will request an application from. With out-of-process      mode, you get the performance of reading from memory and the reliability      of a separate process that manages the state for all servers.&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;SQL Server.&lt;/b&gt; This mode      is best used when the reliability of the data is fundamental to the      stability of the application, as the database can be clustered for failure      scenarios. The performance isn't as fast as out of process, but the      tradeoff is the higher level of reliability.&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;h2&gt;Improvements in ASP.NET 2.0&lt;/h2&gt;  &lt;p&gt;ASP.NET 2.0 was designed to make web development easier and quicker.&lt;/p&gt;  &lt;p&gt;Design goals for ASP.NET 2.0:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Increase productivity by      removing 70% of the code&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Use the same controls for all      types of devices&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Provide a faster and better      web server platform&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Simplify compilation and installation&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Simplify the administration      of web applications&lt;/li&gt;&lt;/ul&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;What's New in ASP.NET 2.0?&lt;/h2&gt;  &lt;p&gt;Some of the new features in ASP.NET 2.0 are:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Master Pages, Themes, and      Web Parts&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Standard controls for      navigation&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Standard controls for      security&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Roles, personalization, and      internationalization services&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Improved and simplified data      access controls&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Full support for XML      standards like, XHTML, XML, and WSDL&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Improved compilation and      deployment (installation)&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Improved site management&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;New and improved development      tools&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;b&gt;The new features are described below&lt;/b&gt;.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Master Pages&lt;/h2&gt;  &lt;p&gt;ASP.NET didn't have a method for applying a consistent look and feel for a whole web site.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Master pages&lt;/b&gt; in ASP.NET 2.0 solves this problem.&lt;/p&gt;  &lt;p&gt;A master page is a template for other pages, with shared layout and functionality. The master page defines placeholders for content pages. The result page is a combination (merge) of the master page and the content page. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/aspnet/aspnet_masterpages.asp"&gt;Read more about master pages&lt;/a&gt;.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Themes&lt;/h2&gt;  &lt;p&gt;Themes is another feature of ASP.NET 2.0. Themes, or skins, allow developers to create a customized look for web applications.&lt;/p&gt;  &lt;p&gt;Design goals for ASP.NET 2.0 themes:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Make it simple to customize      the appearance of a site&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Allow themes to be applied      to controls, pages, and entire sites &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Allow all visual elements to      be customized&lt;/li&gt;&lt;/ul&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Web Parts&lt;/h2&gt;  &lt;p&gt;ASP.NET 2.0 Web Parts can provide a consistent look for a site, while still allowing user customization of style and content.&lt;/p&gt;  &lt;p&gt;New controls:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Zone controls - areas on a page      where the content is consistent &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Web part controls - content      areas for each zone&lt;/li&gt;&lt;/ul&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Navigation&lt;/h2&gt;  &lt;p&gt;ASP.NET 2.0 has built-in navigation controls like&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Site Maps&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Dynamic HTML menus&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Tree Views   &lt;/li&gt;&lt;/ul&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Security&lt;/h2&gt;  &lt;p&gt;Security is very important for protecting confidential and personal information.&lt;/p&gt;  &lt;p&gt;In ASP.NET 2.0 the following controls has been added:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;A Login control, which      provides login functionality&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A LoginStatus control, to      control the login status&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A LoginName control to      display the current user name&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A LoginView control, to      provide different views depending on login status&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A CreateUser wizard, to      allow creation of user accounts&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A PasswordRecovery control,      to provide the "I forgot my password" functionality&lt;/li&gt;&lt;/ul&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Roles and Personalization&lt;/h2&gt;  &lt;p&gt;Internet communities are growing very popular.&lt;/p&gt;  &lt;p&gt;ASP.NET 2.0 has personalization features for storing user details. This provides an easy way to customize user (and user group) properties.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Internationalization&lt;/h2&gt;  &lt;p&gt;Reaching people with different languages is important if you want to reach a larger audience.&lt;/p&gt;  &lt;p&gt;ASP.NET 2.0 has improved support for multiple languages.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Data Access&lt;/h2&gt;  &lt;p&gt;Many web sites are data driven, using databases or XML files as data sources.&lt;/p&gt;  &lt;p&gt;With ASP.NET this involved code, and often the same code had to be used over and over in different web pages.&lt;/p&gt;  &lt;p&gt;A key goal of ASP.NET 2.0 was to ease the use of data sources.&lt;/p&gt;  &lt;p&gt;ASP.NET 2.0 has new data controls, removing much of the need for programming and in-depth knowledge of data connections.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Mobility Support&lt;/h2&gt;  &lt;p&gt;The problem with Mobile devices is screen size and display capabilities.&lt;/p&gt;  &lt;p&gt;In ASP.NET, the Microsoft Mobile Internet Toolkit (MMIT) provided this support.&lt;/p&gt;  &lt;p&gt;In ASP.NET 2.0, MMIT is no longer needed because mobile support is built into all controls.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Images&lt;/h2&gt;  &lt;p&gt;ASP.NET 2.0 has new controls for handling images:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;The ImageMap control -      image map support&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;The DynamicImage      control  - image support for different browsers&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;These controls are important for better image display on mobile devices, like hand-held computers and cell phones.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Automatic Compilation&lt;/h2&gt;  &lt;p&gt;ASP.NET 2.0 provides automatic compilation. All files within a directory will be compiled on the first run, including support for WSDL, and XSD files.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Compiled Deployment (Installation) and Source Protection&lt;/h2&gt;  &lt;p&gt;ASP.NET 2.0 also provides pre-compilation. An entire web site can be pre-compiled. This provides an easy way to deploy (upload to a server) compiled applications, and because only compiled files are deployed, the source code is protected.&lt;/p&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Site Management&lt;/h2&gt;  &lt;p&gt;ASP.NET 2.0 has three new features for web site configuration and management:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;New local management      console&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;New programmable management      functions (API)&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;New web-based management      tool&lt;/li&gt;&lt;/ul&gt;   &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;   &lt;h2&gt;Development Tools&lt;/h2&gt;  &lt;p&gt;With ASP.NET Visual Studio.NET was released with project and design features targeted at corporate developers.&lt;/p&gt;  &lt;p&gt;With ASP.NET 2.0, Visual Studio 2005 was released.&lt;/p&gt;  &lt;p&gt;Key design features for Visual Studio 2005 include:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Support for the features      described above&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Upload files from anywhere      (FTP, File System, Front Page....)&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;No project files, allowing      code to be manipulated outside Visual Studio&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Integrated Web Site      Administration Tool&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;No "build" step -      ability to compile on first run&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;All non-static pages and applications (static: "HTML only" pages, images, etc.) are&lt;br /&gt;interpreted and executed by the server. Application pools (AppPools) were&lt;br /&gt;introduced in IIS 6 as a way of keeping the effects from the code executed by&lt;br /&gt;different virtual servers as encapsulated as possible.&lt;br /&gt;&lt;br /&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1050" type="#_x0000_t75" alt="" style="'width:494.25pt;height:203.25pt'"&gt;  &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image012.jpg" href="http://faq.oneandone.co.uk/image/UK-FAQ/Dedicated/winserver/applocationpool1.jpg"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image012.jpg" shapes="_x0000_i1050" border="0" height="271" width="659" /&gt;&lt;!--[endif]--&gt;&lt;br /&gt;&lt;br /&gt;Each application pool gets it own worker process on the system. By doing this, each&lt;br /&gt;application in a pool will never have an effect on applications in other pools. If&lt;br /&gt;an application causes a process to crash, for example, this only affects the pool&lt;br /&gt;in which it is in. The Web server and other pools continue to run normally.&lt;br /&gt;&lt;br /&gt;Resources such as memory (RAM), CPU load and required CPU time can be limited&lt;br /&gt;separately for each application pool. Pools that generate too many errors within a&lt;br /&gt;specific time frame can be disabled automatically.&lt;br /&gt;&lt;br /&gt;Application pools can be restarted automatically (recycling), e.g. every night or&lt;br /&gt;if certain resources are exceeded. Note however, that all information on the&lt;br /&gt;current sessions (session variables) will be lost.&lt;br /&gt;&lt;br /&gt;You can create as many application pools as you want. The number is limited only by&lt;br /&gt;the resources on the server. Note however, that each running pool consumes system&lt;br /&gt;resources for process management (overhead). Your system easily supports around 25&lt;br /&gt;application pools without noticeable performance loss. The exact number depends on:&lt;br /&gt;&lt;br /&gt;1. Your server's memory and CPU load&lt;br /&gt;2. The number and type of applications in the pools&lt;br /&gt;3. The number of requests for these applications&lt;br /&gt;4. The resource needs of other applications/programmes running on the server&lt;br /&gt;&lt;br /&gt;Applications can be assigned to a specific pool in their properties. You can assign&lt;br /&gt;an application pool at the bottom of the "Home Directory" tab (or a "directory" if&lt;br /&gt;it is a lower-level application). New pools can be created by right-clicking&lt;br /&gt;on "Application Pools".&lt;br /&gt;&lt;br /&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1051" type="#_x0000_t75" alt="" style="'width:345.75pt;height:355.5pt'"&gt;  &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image013.jpg" href="http://faq.oneandone.co.uk/image/UK-FAQ/Dedicated/winserver/applocationpool2.jpg"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image013.jpg" shapes="_x0000_i1051" border="0" height="474" width="461" /&gt;&lt;!--[endif]--&gt;&lt;br /&gt;&lt;br /&gt;Because each pool is assigned an identity (user), all applications in the pool run&lt;br /&gt;using these permissions. Applications running in a pool as Administrator (not&lt;br /&gt;recommended!) would then have administrative rights, can read related files, power&lt;br /&gt;down the server, etc. Use the "Network Service" identity or a custom user to&lt;br /&gt;restrict access.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;In this part, we will take a look at one of the new features in IIS 6.0, named Application Pool, and demonstrate the use of application pools in isolating ASP.NET Web applications, thereby increasing the reliability of your ASP.NET Web applications. Then, we also will explore how these application pools affect ASP.NET applications in terms of the identity that is used to run your ASP.NET applications. Along the way, we will also look at the steps to be followed for creating application pools and assigning ASP.NET applications to run under a specific application pool. Finally, we will illustrate how to configure an application pool to run using the credentials of a specific user account.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h3&gt;&lt;span style="font-family: Verdana;"&gt;What is an Application Pool?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;An Application Pool can contain one or more applications and allows us to configure a level of isolation between different Web applications. For example, if you want to isolate all the Web applications running in the same computer, you can do this by creating a separate application pool for every Web application and placing them in their corresponding application pool. Because each application pool runs in its own worker process, errors in one application pool will not affect the applications running in other application pools. Deploying applications in application pools is a primary advantage of running IIS 6.0 in worker process isolation mode because you can customize the application pools to achieve the degree of application isolation that you need.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;When you configure application pools for optimum availability, you also should consider how to configure application pools for application security. For example, you might need to create separate application pools for applications that require a high level of security, while allowing applications that require a lower level of security to share the same application pool. In the later part of this article, we will see how to configure identities at the application pool level.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h4&gt;&lt;span style="font-family: Verdana;"&gt;Creating a new Application Pool&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Creating a new application pool is a very simple process that is carried out by using the IIS manager. When you create a new application pool, you have the following two options:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ol start="1" type="1"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;You can either create a new application pool      from scratch or&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;You can create a new application by importing      the configuration settings from an external XML file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;To create a new application pool from scratch, right-click on the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Application Pools&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; node from the tree view and select &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;New-&gt;Application Pool&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; from the context menu. You will be presented with the following screen, where you need to enter a name for the application pool.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1052" type="#_x0000_t75" alt="" style="'width:302.25pt;height:164.25pt'"&gt;  &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image014.gif" href="http://www.developer.com/img/articles/2003/08/06/IIS6P21.gif"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image014.gif" shapes="_x0000_i1052" border="0" height="219" width="403" /&gt;&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;When creating a new application, you also have the option of inheriting the settings from an existing application pool. For example, if you want your new application pool to inherit the settings from the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;DefaultAppPool&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;, you can do that by selecting the option &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Use existing application pool&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; as a template in the above screen. After you pick this option, the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Application Pool&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; name dropdown box will be enabled from where you can select an existing application pool.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;After the pool is created, you can save the settings of the application pool to an external XML file any time by right-clicking the application pool and selecting the option &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;All Tasks-&gt;Save Configuration to a File&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; that is available from the context menu. This is an extremely useful feature that makes it possible for you to easily recreate the same application pool on the same server or on a different server with minimal effort.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h3&gt;&lt;span style="font-family: Verdana;"&gt;Configuring Identity for ASP.NET Web Applications&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;In previous versions of IIS, worker processes ran as &lt;b&gt;LocalSystem&lt;/b&gt;, a powerful account that has system administrator privileges on the server. Because &lt;b&gt;LocalSystem&lt;/b&gt; has access to almost all resources on the operating system, this caused security implications. As mentioned previously, in IIS 6.0, you can set the identity of the worker process at the application pool level. The identity of an application pool is the account under which the application pool's worker process runs. By default, application pools operate under the &lt;b&gt;NetworkService&lt;/b&gt; account, which has low-level user access rights. The NetworkService account has the following seven privileges:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Adjust memory quotas for a process&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Generate security audits&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Log on as a service&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Replace process level token&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Impersonate a client after authentication&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Allow logon locally&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Access this computer from the network&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;By running the worker process using a very low-privileged account such as NetworkService, you can reduce the security vulnerability. However, by using IIS manager, you can configure the application pool to run as any of the following pre-defined accounts:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;NetworkService&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;LocalSystem&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;LocalService&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;To configure identity for an application pool, right-click the application pool and select &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Properties&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; from the context menu. In the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Properties&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; dialog box, select the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Identity&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; tab and you will see the following screen.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1053" type="#_x0000_t75" alt="" style="'width:350.25pt;height:330.75pt'"&gt;  &lt;v:imagedata src="file:///C:/DOCUME~1/soft.1/LOCALS~1/Temp/msoclip1/01/clip_image015.gif" href="http://www.developer.com/img/articles/2003/08/06/IIS6P22.gif"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/soft.1/LOCALS%7E1/Temp/msoclip1/01/clip_image015.gif" shapes="_x0000_i1053" border="0" height="441" width="467" /&gt;&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;In the above dialog box, when you select the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Predefined&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; option, you can select any of the pre-defined accounts from the dropdown box. Instead of using a pre-defined account, if you want your application pool to run under a different account, select the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Configurable&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; option and then set the &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;User name&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; and &lt;/span&gt;&lt;tt&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Password&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; in the textboxes. This approach is particularly useful especially when you are running multiple applications or sites on one Web server. For example, if an ISP hosts two companies—who may even be competitors—on one Web server, it has to guarantee that these two applications run in isolation from each other. More importantly, the ISP has to make sure that a malicious administrator for one application can't access the data of the other application. You can accomplish this level of isolation by using the configurable worker process identity.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;Each computer on which the common language runtime is installed has a machine-wide code cache called the 'Global Assembly Cache'. The global assembly cache (or GAC as it is commonly known) stores &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconassemblies.asp" target="_blank"&gt;assemblies&lt;/a&gt; specifically designated to be shared by several applications on the computer. The global assembly cache is located in 'Windows/WinNT' directory and inherits the directory's access control list that administrators have used to protect the folder.&lt;br /&gt;&lt;br /&gt;Assemblies installed in GAC should adhere to a specific versioning scheme that will allow them for side-by-side execution (multiple versions of the same assembly can be maintained in the GAC) of different code versions.&lt;br /&gt;&lt;br /&gt;Shared Assemblies including all the important .NET System assemblies implementing the Framework Class Library reside within GAC. The GAC was originally called Fusion Cache and is implemented using Fusion.dll in .NET Framework.&lt;br /&gt;&lt;br /&gt;Assemblies placed in the GAC must have the same assembly name and file name (not including the file name extension). For example, an assembly with the assembly name of 'myAssembly' must have a file name of either 'myAssembly.exe' or 'myAssembly.dll'.&lt;br /&gt;&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;Scenarios for installing Assemblies in GAC&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There are multiple reasons why an assembly should be installed in GAC:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;b&gt;File Security:&lt;/b&gt;&lt;br /&gt;    &lt;br /&gt;     Administrators usually protect the 'Windows/WinNT' directory using an      access control list (ACL) to control access. Because the GAC is located in      'Windows/WinNT' folder, this means that the GAC folder inherits the access      rights from the 'Windows/WinNT' folder, and only administrators can modify      the contents of the GAC. This will ensure that assemblies that are      installed in GAC are not being accidentally removed/modified by      in-experienced users.&lt;br /&gt;      &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;      &lt;!--[endif]--&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;b&gt;Shared Location:&lt;/b&gt;&lt;br /&gt;    &lt;br /&gt;     GAC acts as a common place for installing assemblies that are shared by      multiple applications on the same machine. A common misconception is that      in order to make the .NET assemblies available to COM InterOp or to the      unmanaged code, the assemblies should be installed in GAC. However, this      does not mandate installing assemblies in the GAC. Only those assemblies      that are shared with other applications on the same machine should be      installed in GAC.&lt;br /&gt;      &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;      &lt;!--[endif]--&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;b&gt;Side-by-Side versioning:&lt;/b&gt;&lt;br /&gt;    &lt;br /&gt;     Side-by-side execution means having the ability to install and use      multiple versions of the same assembly. In simple words side-by-side      versioning means having the same assembly present with multiple versions      but with the same name. GAC can contain multiple copies of the same      assembly with different versions, which allows a robust support for      versioning in the Common Language Runtime.&lt;br /&gt;      &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;      &lt;!--[endif]--&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;As an additional search      location:&lt;/b&gt;&lt;br /&gt;    &lt;br /&gt;     When an assembly needs to be loaded by the Common Language Runtime, the      CLR first checks the GAC for the assembly.&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;Pre-Requisites for installing an assembly in GAC&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;To install an assembly in GAC, the assembly must be signed with a strong name.&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 3.75pt 15pt 1.5pt;"&gt;Quote:&lt;/p&gt;  &lt;table style="width: 100%; margin-left: 15pt;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="border: 0.75pt inset ; padding: 2.25pt;"&gt;   &lt;p class="MsoNormal"&gt;Originally Posted by &lt;strong&gt;.NET Framework Documentation&lt;/strong&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;br /&gt;  A strong name consists of the assembly's identity — its simple text name,   version number, and culture information (if provided) — plus a public key and   a digital signature. It is generated from an assembly file (the file that   contains the assembly manifest, which in turn contains the names and hashes   of all the files that make up the assembly), using the corresponding private   key.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal" style="margin: 15pt 0in 12pt;"&gt;&lt;br /&gt;In order to help assemblies to sign with a string name, one can use the &lt;a href="http://msdn2.microsoft.com/en-us/library/k5b5tt23.aspx" target="_blank"&gt;Strong Name Tool&lt;/a&gt;. Further information can also be found in the following &lt;a href="http://msdn2.microsoft.com/en-us/library/6f05ezxy.aspx" target="_blank"&gt;article&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;b&gt;Installing/uninstalling an assembly in GAC&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There are multiple ways of installing an assembly in GAC:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;b&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondeployingcommonlanguageruntimeapplicationusingwindowsinstaller.asp" target="_blank"&gt;Using Windows Installer&lt;/a&gt;:&lt;/b&gt;&lt;br /&gt;    &lt;br /&gt;     This is a preferred way for installing shared assemblies and should be the      only way to install the shared assemblies on production systems (or      non-development machines).&lt;br /&gt;      &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;      &lt;!--[endif]--&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;b&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfglobalassemblycacheutilitygacutilexe.asp" target="_blank"&gt;Global Assembly Cache Tool&lt;/a&gt;:&lt;/b&gt;&lt;br /&gt;    &lt;br /&gt;     The Global Assembly Cache Utility Tool can be used to install or uninstall      assemblies in GAC. It also allows us to view or manipulate the contents of      the GAC. The common syntax of 'GACUTIL.exe' is:&lt;br /&gt;      &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;      &lt;!--[endif]--&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal" style="margin-right: 15pt; margin-bottom: 1.5pt; margin-left: 51pt;"&gt;Code:&lt;/p&gt;  &lt;div style="border: 0.75pt inset ; padding: 2pt;"&gt;&lt;pre style="border: medium none ; margin: 1.5pt 15pt 0.0001pt 51pt; padding: 0in;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre style="border: medium none ; margin: 1.5pt 15pt 0.0001pt 51pt; padding: 0in;"&gt;gacutil [options] [assemblyName | assemblyPath | assemblyListFile]&lt;/pre&gt;&lt;/div&gt;  &lt;p class="MsoNormal" style="margin: 15pt 0in 12pt 0.5in;"&gt;&lt;br /&gt;To install a strong named assembly from the command prompt in the GAC use:&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: 15pt; margin-bottom: 1.5pt; margin-left: 51pt;"&gt;Code:&lt;/p&gt;  &lt;div style="border: 0.75pt inset ; padding: 2pt;"&gt;&lt;pre style="border: medium none ; margin: 1.5pt 15pt 0.0001pt 51pt; padding: 0in;"&gt;gacutil /i myAssembly.dll&lt;/pre&gt;&lt;/div&gt;  &lt;p class="MsoNormal" style="margin: 15pt 0in 12pt 0.5in;"&gt;&lt;br /&gt;To uninstall a strong named assembly from the command prompt in the GAC use:&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: 15pt; margin-bottom: 1.5pt; margin-left: 51pt;"&gt;Code:&lt;/p&gt;  &lt;div style="border: 0.75pt inset ; padding: 2pt;"&gt;&lt;pre style="border: medium none ; margin: 1.5pt 15pt 0.0001pt 51pt; padding: 0in;"&gt;gacutil /u myAssembly.dll&lt;/pre&gt;&lt;/div&gt;  &lt;p class="MsoNormal" style="margin: 15pt 0in 12pt 0.5in;"&gt;&lt;br /&gt;To view the contents of the GAC we can use:&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: 15pt; margin-bottom: 1.5pt; margin-left: 51pt;"&gt;Code:&lt;/p&gt;  &lt;div style="border: 0.75pt inset ; padding: 2pt;"&gt;&lt;pre style="border: medium none ; margin: 1.5pt 15pt 0.0001pt 51pt; padding: 0in;"&gt;gacutil /l&lt;/pre&gt;&lt;/div&gt;  &lt;p class="MsoNormal" style="margin: 15pt 0in 12pt 0.5in;"&gt;&lt;br /&gt;To check if an assembly ('myAssembly.dll') is already present in the GAC:&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: 15pt; margin-bottom: 1.5pt; margin-left: 51pt;"&gt;Code:&lt;/p&gt;  &lt;div style="border: 0.75pt inset ; padding: 2pt;"&gt;&lt;pre style="border: medium none ; margin: 1.5pt 15pt 0.0001pt 51pt; padding: 0in;"&gt;gacutil /l myAssembly.dll&lt;/pre&gt;&lt;/div&gt;  &lt;p class="MsoNormal" style="margin: 15pt 0in 12pt 0.5in;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;Other ways:&lt;/b&gt;&lt;br /&gt;    &lt;br /&gt;     There are other ways also to install/uninstall the assemblies to/from GAC      and to view the contents. Following links will give some insight on these      tools:&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana; color: rgb(153, 0, 0);"&gt;Advantages of using GAC are:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ol start="1" type="1"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 12pt 0.5in;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana; color: rgb(153, 0, 0);"&gt;Strong name signature verification:&lt;/span&gt;&lt;/strong&gt; All shared assemblies must have strong name signatures. These signature are verified when the assembly is installed into the gac. Once verified the signatures are not verified each time the assembly is referenced. In contrast, shared assemblies deployed outside the assembly have their signatures verified each time the assembly is loaded.&lt;/p&gt;  &lt;ol style="margin-top: 0in;" start="2" type="1"&gt;&lt;li class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana; color: rgb(153, 0, 0);"&gt;Performance:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: Verdana;"&gt;CLR to look into the GAC first when resolving an Assembly      reference.  If it doesn't find the requested assembly in the GAC then      it looks in the application directory and follows the rest of the probing      logic algorithm.  Clearly there is a performance gain by putting the      assembly in the first place to be searched.&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana; color: rgb(153, 0, 0);"&gt;Deploying bug      fixes:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: Verdana;"&gt;Administrators can      use the gac to deploy bug fixes intended to be picked up by all      applications. By deploying the fix to the gac and stating the appropriate      version policy in the machine configuration file, an admin can ensure that      all applications on the machine will begin to use the fix.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if !supportEmptyParas]--&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-827539033790793935?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/827539033790793935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=827539033790793935' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/827539033790793935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/827539033790793935'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/10/dotnet-concets.html' title='dotnet concets'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-4478112611845337931</id><published>2008-09-26T08:08:00.000-07:00</published><updated>2008-09-26T08:09:29.791-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DotIntevriew preperation'/><title type='text'>DotIntevriew preperation</title><content type='html'>State Management in ASP.NET&lt;br /&gt; Web form pages are HTTP-Based, they are stateless, which means they don’t know whether the requests are all from the same client, and pages are destroyed and recreated with each round trip to the server, therefore information will be lost, therefore state management is really an issue in developing web applications&lt;br /&gt;We could easily solve these problems in ASP with cookie, query string, application, session and so on. Now in ASP.NET, we still can use these functions, but they are richer and more powerful, so let’s dive into it.&lt;br /&gt;Mainly there are two different ways to manage web page’s state: Client-side and Server-side.&lt;br /&gt;1.Client-side state management :There is no information maintained on the server between round trips. Information will be stored in the page or on the client’s computer.&lt;br /&gt;A. Cookies.&lt;br /&gt;A cookie is a small amount of data stored either in a text file on the client's file system or in-memory in the client browser session. Cookies are mainly used for tracking data settings. Let’s take an example: say we want to customize a welcome web page, when the user request the default web page, the application first to detect if the user has logined before, we can retrieve the user informatin from cookies:&lt;br /&gt;[c#]&lt;br /&gt;if (Request.Cookies[“username”]!=null)&lt;br /&gt;lbMessage.text=”Dear “+Request.Cookies[“username”].Value+”, Welcome shopping here!”;&lt;br /&gt;else&lt;br /&gt;lbMessage.text=”Welcome shopping here!”;&lt;br /&gt;&lt;br /&gt;If you want to store client’s information, you can use the following code:&lt;br /&gt;[c#]&lt;br /&gt;Response.Cookies[“username’].Value=username;&lt;br /&gt;&lt;br /&gt;So next time when the user request the web page, you can easily recongnize the user again.B. Hidden Field&lt;br /&gt;A hidden field does not render visibly in the browser, but you can set its properties just as you can with a standard control. When a page is submitted to the server, the content of a hidden field is sent in the HTTP Form collection along with the values of other controls. A hidden field acts as a repository for any page-specific information that you would like to store directly in the page. Hidden field stores a single variable in its value property and must be explicitly added it to the page.&lt;br /&gt;ASP.NET provides the HtmlInputHidden control that offers hidden field functionality. &lt;br /&gt;[c#]&lt;br /&gt;protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden1;&lt;br /&gt;//to assign a value to Hidden field&lt;br /&gt;Hidden1.Value=”this is a test”;&lt;br /&gt;//to retrieve a value &lt;br /&gt;string str=Hidden1.Value;&lt;br /&gt;&lt;br /&gt;Note: Keep in mind, in order to use hidden field, you have to use HTTP-Post method to post web page. Although its name is ‘Hidden’, its value is not hidden, you can see its value through ‘view source’ function.&lt;br /&gt;C. View State &lt;br /&gt;&lt;br /&gt;Each control on a Web Forms page, including the page itself, has a ViewState property, it is a built-in struture for automatic retention of page and control state, which means you don’t need to do anything about getting back the data of controls after posting page to the server.&lt;br /&gt;&lt;br /&gt;Here, which is useful to us is the ViewState property, we can use it to save information between round trips to the server.&lt;br /&gt;[c#]&lt;br /&gt;//to save information&lt;br /&gt;ViewState.Add(“shape”,”circle”);&lt;br /&gt;//to retrieve information&lt;br /&gt;string shapes=ViewState[“shape”];&lt;br /&gt;&lt;br /&gt;Note: Unlike Hidden Field, the values in ViewState are invisible when ‘view source’, they are compressed and encoded.&lt;br /&gt;&lt;br /&gt;D. Query Strings&lt;br /&gt;Query strings provide a simple but limited way of maintaining some state information.You can easily pass information from one page to another, But most browsers and client devices impose a 255-character limit on the length of the URL. In addition, the query values are exposed to the Internet via the URL so in some cases security may be an issue. &lt;br /&gt;A URL with query strings may look like this:&lt;br /&gt;&lt;br /&gt;http://www.examples.com/list.aspx?categoryid=1&amp;productid=101&lt;br /&gt;&lt;br /&gt;When list.aspx is being requested, the category and product information can be obtained by using the following codes:&lt;br /&gt;[c#]&lt;br /&gt;string categoryid, productid;&lt;br /&gt;categoryid=Request.Params[“categoryid”];&lt;br /&gt;productid=Request.Params[“productid”];&lt;br /&gt;&lt;br /&gt;Note: you can only use HTTP-Get method to post the web page, or you will never get the value from query strings.&lt;br /&gt;&lt;br /&gt;2. Server-side state management:&lt;br /&gt;Information will be stored on the server, it has higher security but it can use more web server resources.&lt;br /&gt;A. Aplication object&lt;br /&gt;The Application object provides a mechanism for storing data that is accessible to all code running within the Web application, The ideal data to insert into application state variables is data that is shared by multiple sessions and does not change often.. And just because it is visible to the entire application, you need to used Lock and UnLock pair to avoid having conflit value.&lt;br /&gt;[c#]&lt;br /&gt;Application.Lock();&lt;br /&gt;Application[“mydata”]=”mydata”;&lt;br /&gt;Application.UnLock();&lt;br /&gt;B. Session object &lt;br /&gt;&lt;br /&gt;Session object can be used for storing session-specific information that needs to be maintained between server round trips and between requests for pages. Session object is per-client basis, which means different clients generate different session object.The ideal data to store in session-state variables is short-lived, sensitive data that is specific to an individual session.&lt;br /&gt;&lt;br /&gt;Each active ASP.NET session is identified and tracked using a 120-bit SessionID string containing URL-legal ASCII characters. SessionID values are generated using an algorithm that guarantees uniqueness so that sessions do not collide, and SessionID’s randomness makes it harder to guess the session ID of an existing session.&lt;br /&gt;SessionIDs are communicated across client-server requests either by an HTTP cookie or a modified URL, depending on how you set the application's configuration settings. So how to set the session setting in application configuration? Ok, let’s go further to look at it.&lt;br /&gt;&lt;br /&gt;Every web application must have a configuration file named web.config, it is a XML-Based file, there is a section name ‘sessionState’, the following is an example:&lt;br /&gt;&lt;br /&gt;&lt;sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="20" /&gt;&lt;br /&gt;&lt;br /&gt;‘cookieless’ option can be ‘true’ or ‘false’. When it is ‘false’(default value), ASP.NET will use HTTP cookie to identify users. When it is ‘true’, ASP.NET will randomly generate a unique number and put it just right ahead of the requested file, this number is used to identify users, you can see it on the address bar of IE:&lt;br /&gt;&lt;br /&gt;http://localhost/Management/(2yzakzez3eqxut45ukyzq3qp)/Default.aspx&lt;br /&gt;&lt;br /&gt;Ok, it is further enough, let is go back to session object.&lt;br /&gt;[c#]&lt;br /&gt;//to store information&lt;br /&gt;Session[“myname”]=”Mike”;&lt;br /&gt;//to retrieve information&lt;br /&gt;myname=Session[“myname”];&lt;br /&gt;C. Database &lt;br /&gt;&lt;br /&gt;Database enables you to store large amount of information pertaining to state in your Web application. Sometimes users continually query the database by using the unique ID, you can save it in the database for use across multiple request for the pages in your site.&lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;ASP.NET has more functions and utilities than ASP to enable you to manage page state more efficient and effective. Choosing among the options will depand upon your application, you have to think about the following before making any choose:&lt;br /&gt;· How much information do you need to store? &lt;br /&gt;· Does the client accept persistent or in-memory cookies? &lt;br /&gt;· Do you want to store the information on the client or server? &lt;br /&gt;· Is the information sensitive? &lt;br /&gt;· What kind of performance experience are you expecting from your pages? &lt;br /&gt;Client-side state management summary&lt;br /&gt;Method  Use when&lt;br /&gt;Cookies You need to store small amounts of information on the client and security is not an issue.&lt;br /&gt;View state You need to store small amounts of information for a page that will post back to itself. Use of the ViewState property does supply semi-secure functionality.&lt;br /&gt;Hidden fields You need to store small amounts of information for a page that will post back to itself or another page, and security is not an issue. Note   You can use a hidden field only on pages that are submitted to the server. &lt;br /&gt;Query string You are transferring small amounts of information from one page to another and security is not an issue. Note   You can use query strings only if you are requesting the same page, or another page via a link. &lt;br /&gt;Server-side state management summary&lt;br /&gt;Method Use when&lt;br /&gt;Application state object  You are storing infrequently changed, application-scope information that is used by many users, and security is not an issue. Do not store large quantities of information in an application state object.&lt;br /&gt;Session state object  You are storing short-lived information that is specific to an individual session, and security is an issue. Do not store large quantities of information in a session state object. Be aware that a session state object will be created and maintained for the lifetime of every session in your application. In applications hosting many users, this can occupy significant server resources and affect scalability.&lt;br /&gt;Database support You are storing large amounts of information, managing transactions, or the information must survive application and session restarts. Data mining is a concern, and security is an issue.&lt;br /&gt;Developing ASP.NET programme is really funny, once you jump into it, you can feel the power of it. Next time let us talk about another topic: Cache. Enjoy .Net!!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Diff bewteen cust &amp; user control&lt;br /&gt;&lt;br /&gt;Custom controls are controls that are developed by the developer&lt;br /&gt;or a third party vendor. Custom controls are not provided along with &lt;br /&gt;.NET. &lt;br /&gt;&lt;br /&gt;Difference between Custom Controls and User Controls.&lt;br /&gt;&lt;br /&gt;1.User Control is a page file with extension .ascx which can only be used within&lt;br /&gt;a single application. But custom controls are assemblies(dll files) that can be &lt;br /&gt;used in multiple applications.&lt;br /&gt;&lt;br /&gt;2.User Controls cannot be added to the ToolBox of VS.NET . To use a user Control with in an&lt;br /&gt;aspx page u have to drag the user Control from the solution Explorer to designer page.&lt;br /&gt;But Custom Controls can be added to ToolBox of VS.NET.&lt;br /&gt;&lt;br /&gt;3.User Controls can be viewed as a sort of generic controls during the design time.&lt;br /&gt;The proper GUI of user controls can be viewed only during the run time.&lt;br /&gt;But Custom Controls can be viewed during the design time.&lt;br /&gt;&lt;br /&gt;4. User controls are created from existing Webserver and html server controls .&lt;br /&gt;But a developer who creates custom controls have to render every thing from the scratch.&lt;br /&gt;&lt;br /&gt;5.Since the dll assembly of a custom control is being used,a custom control developed in C# can be used in a project developed in VB.NET or any other managed code and vice versa.&lt;br /&gt;This is not possible with user controls.They are language spefic&lt;br /&gt;&lt;br /&gt;We cannot give any examples for custom controls since they are developed either by a developer of a third party vendor.&lt;br /&gt;&lt;br /&gt;Re: How do you create a permanent cookie? Answer&lt;br /&gt;# 1 &lt;br /&gt;Cookie is like a temporary file which contains a name and a &lt;br /&gt;value pair and resides in the client.&lt;br /&gt;&lt;br /&gt;cookie prepared or modified by the server side script will &lt;br /&gt;be appended to the response and will be sent to the client.&lt;br /&gt;&lt;br /&gt;dim cook as httpcookie&lt;br /&gt;cook=new httpcookie("items")&lt;br /&gt;cook.value=textbox1.text&lt;br /&gt;response.appendcookie(cook).&lt;br /&gt;    Re: How do you create a permanent cookie? Answer&lt;br /&gt;# 2 &lt;br /&gt;You can set the permanent cookied by setting the expiry &lt;br /&gt;date to the MaxDate&lt;br /&gt;&lt;br /&gt;&lt;%&lt;br /&gt;Response.Cookies("username") = "you"&lt;br /&gt;Response.Cookies("username").Expires = Date.MaxValue &lt;br /&gt;%&gt;&lt;br /&gt;   Re: How do you create a permanent cookie? Answer&lt;br /&gt;# 3 &lt;br /&gt;by setting the expiry property greater than &lt;br /&gt;datetime.minvalue...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PI Imort or latform Import =  DLL Imort – UnManaged code&lt;br /&gt;&lt;br /&gt;Diff b/w dg and dr&lt;br /&gt;Datagrid is &lt;br /&gt;* one which has advanced features and lets you do lot many things like &lt;b&gt;paging and sorting &lt;/b&gt;your data without much effort.&lt;br /&gt;* DataGrid can hold text data, but not linked or embedded objects.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Whereas a DataRepeater is &lt;br /&gt;* which does not have the paging feature but we can do it by coding.&lt;br /&gt;* one which can hold other controls and can embed objects.&lt;br /&gt;* It can embed a Datagrid within it but not viceversa.&lt;br /&gt;&lt;br /&gt;Apart from this a Data Repeater&lt;br /&gt;--is used in places where you need more control over the rendering of your data&lt;br /&gt;-- have very flexible templates that give you total control over the formatting of your data&lt;br /&gt;&lt;br /&gt;Repeator Control:&lt;br /&gt;·&lt;br /&gt;1)Read-only; no inherent support for selection or editing · &lt;br /&gt;2)No inherent look; you lay out the list by creating templates. &lt;br /&gt;3)List can be vertical, horizontal, all on one line, or in any format you specify. ·&lt;br /&gt;4)No default paging; all data is displayed in a single list. · &lt;br /&gt;5)Separators between elements can be defined using a template&lt;br /&gt;&lt;br /&gt;Datagrid:&lt;br /&gt;&lt;br /&gt;1)Default look is a grid (customizable table) · &lt;br /&gt;2)Can customize look of table extensively. ·&lt;br /&gt;3)Options for auto-formatting. ·&lt;br /&gt;4)Can specify output using bound columns, columns of buttons or hyperlinks, and custom &lt;br /&gt;columns created using templates. · &lt;br /&gt;5)No separator template. However, the grid renders in a table, and you can specify table border size and color. ·&lt;br /&gt;6)WYSIWYG template editing ·&lt;br /&gt;7)Items support styles for custom look. ·&lt;br /&gt;8)Editable contents, including deletion ·&lt;br /&gt;9)Single and multiple selection ·&lt;br /&gt;10)Optional paged output ·Support for sorting ·&lt;br /&gt;11)Support for custom functionality that can be applied to items&lt;br /&gt;&lt;br /&gt;Introduction:&lt;br /&gt;&lt;br /&gt;1. Classes are reference types and structs are value types.&lt;br /&gt;&lt;br /&gt;Since classes are reference type, a class variable can be assigned null.But we cannot assign null to &lt;br /&gt;&lt;br /&gt;a struct variable, since structs are value type.&lt;br /&gt;&lt;br /&gt;struct AStruct&lt;br /&gt;{&lt;br /&gt;   int aField;&lt;br /&gt;}&lt;br /&gt;class  AClass&lt;br /&gt;{&lt;br /&gt;   int aField;&lt;br /&gt;}&lt;br /&gt;class MainClass&lt;br /&gt;{&lt;br /&gt; public static void Main()&lt;br /&gt; {&lt;br /&gt;  AClass b = null;  // No error.&lt;br /&gt;  AStruct s = null; // Error [ Cannot convert null to 'AStruct' &lt;br /&gt;&lt;br /&gt;because it is a value type ].&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. When you instantiate a class, it will be allocated on the heap.When you &lt;br /&gt;&lt;br /&gt;instantiate a struct, it gets created on the stack.&lt;br /&gt;&lt;br /&gt;3. You will always be dealing with reference to an object ( instance ) of a class. But &lt;br /&gt;&lt;br /&gt;you will not be dealing with references to an instance of a struct ( but dealing directly &lt;br /&gt;&lt;br /&gt;with them ).&lt;br /&gt;&lt;br /&gt;4. When passing a class to a method, it is passed by reference. When passing a &lt;br /&gt;&lt;br /&gt;struct to a method, it's passed by value instead of as a reference.&lt;br /&gt;&lt;br /&gt;5. You cannot have instance Field initializers in structs.But classes can have &lt;br /&gt;&lt;br /&gt;initializers. &lt;br /&gt;&lt;br /&gt;class MyClass&lt;br /&gt;{&lt;br /&gt;    int myVar =10;  //  no syntax error.&lt;br /&gt;    public void MyFun( )&lt;br /&gt;    {&lt;br /&gt;       //  statements&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;struct MyStruct&lt;br /&gt;{&lt;br /&gt;    int myVar = 10;  //  syntax error.&lt;br /&gt;    public void MyFun( )&lt;br /&gt;    {&lt;br /&gt;       //  statements&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;6. Classes can have explicit parameterless constructors. But structs cannot have &lt;br /&gt;&lt;br /&gt;explicit parameterless constructors.&lt;br /&gt;&lt;br /&gt;class MyClass&lt;br /&gt;{&lt;br /&gt;   int myVar = 10;&lt;br /&gt;   public MyClass( ) // no syntax error.&lt;br /&gt;   {&lt;br /&gt; // statements&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;struct MyStruct&lt;br /&gt;{&lt;br /&gt;   int myVar;&lt;br /&gt;   public MyStruct( ) // syntax error.&lt;br /&gt;   {&lt;br /&gt;       // statements&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;7. Classes must be instantiated using the new operator. But structs can be &lt;br /&gt;&lt;br /&gt;instantiated without using the new operator.&lt;br /&gt;&lt;br /&gt;MyClass aClassObj;  //  MyClass aClassObj=new MyClass(); is the correct &lt;br /&gt;&lt;br /&gt;format.&lt;br /&gt;aClassObj.myVar=100;//NullReferenceException(because aClassObj does not contain a &lt;br /&gt;&lt;br /&gt;reference to an object of type myClass).&lt;br /&gt; &lt;br /&gt;MyStruct  aStructObj;&lt;br /&gt;aStructObj.myVar=100; //  no exception.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;face="verdana"size="2"&gt;&lt;br /&gt;8. Classes support inheritance.But there is no inheritance for structs.&lt;br /&gt;( structs don't support inheritance polymorphism )&lt;br /&gt;&lt;br /&gt;So we cannot have a base structure and a derived structure.&lt;br /&gt;&lt;br /&gt;(1)&lt;br /&gt;struct MyStruct&lt;br /&gt;{&lt;br /&gt; int aStructVar;&lt;br /&gt; internal void aStructMethod()&lt;br /&gt; {&lt;br /&gt;     // statements&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;class MyClass : MyStruct   // Syntax error.&lt;br /&gt;{&lt;br /&gt; int aClassVar;&lt;br /&gt; int aClassMethod()&lt;br /&gt; {&lt;br /&gt;     // statements&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;(2)&lt;br /&gt;class MyClass &lt;br /&gt;{&lt;br /&gt; int aClassVar;&lt;br /&gt; int aClassMethod()&lt;br /&gt; {&lt;br /&gt;     // statements&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;struct MyStruct : MyClass   // Syntax error.&lt;br /&gt;{&lt;br /&gt; int aStructVar;&lt;br /&gt; internal void aStructMethod()&lt;br /&gt; {&lt;br /&gt;     // statements&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Note : Like classes, structures can implement interfaces&lt;br /&gt;&lt;br /&gt;9. Since struct does not support inheritance, access modifier of a member of a struct cannot be protected or protected internal.&lt;br /&gt;&lt;br /&gt;10. It is not mandatory to initialize all Fields inside the constructor of a class.&lt;br /&gt;But all the Fields of a struct must be fully initialized inside the constructor.&lt;br /&gt;&lt;br /&gt;class MyClass //No error( No matter whether the Field ' MyClass.myString ' is &lt;br /&gt;&lt;br /&gt;initialized or not ). &lt;br /&gt;{&lt;br /&gt;   int myInt;&lt;br /&gt;   string myString;&lt;br /&gt;&lt;br /&gt;   public MyClass( int aInt )  &lt;br /&gt;    {&lt;br /&gt; myInt = aInt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;struct MyStruct // Error ( Field ' MyStruct.myString ' must be fully assigned &lt;br /&gt;&lt;br /&gt;before it leaves the constructor ).&lt;br /&gt;{&lt;br /&gt;   int myInt;&lt;br /&gt;   string myString;&lt;br /&gt;&lt;br /&gt;   public MyStruct( int aInt )&lt;br /&gt;    {&lt;br /&gt; myInt = aInt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;11. A class is permitted to declare a destructor.But a struct is not &lt;br /&gt;&lt;br /&gt;permitted to declare a destructor.&lt;br /&gt;&lt;br /&gt;struct MyStruct&lt;br /&gt;{&lt;br /&gt;    int myInt;&lt;br /&gt;    public MyStruct( )&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;    ~MyStruct( )   //Error.&lt;br /&gt;     {&lt;br /&gt;         Console.WriteLine("Destructor of MyStruct object");&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class MyClass&lt;br /&gt;{&lt;br /&gt;    int myInt;&lt;br /&gt;    public MyClass( )&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;    ~MyClass( ) // No Error.&lt;br /&gt;     {&lt;br /&gt;         Console.WriteLine("Destructor of MyClass object");&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;12. classes are used for complex and large set data. structs are simple to use. &lt;br /&gt;&lt;br /&gt;structs are useful whenever you need a type that will be used often and is mostly just a &lt;br /&gt;&lt;br /&gt;piece of data.&lt;br /&gt;&lt;br /&gt;A Sample Code:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System; &lt;br /&gt;class MainClass&lt;br /&gt;{&lt;br /&gt;  &lt;br /&gt;  static void Main( )&lt;br /&gt;    {&lt;br /&gt; Console.WriteLine( "Struct \n" );&lt;br /&gt; MyStruct var1=new MyStruct( );&lt;br /&gt;   &lt;br /&gt; var1.Member="Initialized";&lt;br /&gt;&lt;br /&gt; // value of var1 is assigned to var2&lt;br /&gt; MyStruct var2=var1;//   stmt --&gt; [A]&lt;br /&gt;   &lt;br /&gt; //var1.str &amp; var2.str are different memory locations in the stack.&lt;br /&gt; Console.WriteLine(var1.Member+"\n"+var2.Member);&lt;br /&gt; Console.WriteLine( "---------------" );&lt;br /&gt;   &lt;br /&gt; var1.Member="Assigned";   &lt;br /&gt; Console.WriteLine( var1.Member+"\n"+var2.Member );&lt;br /&gt;   &lt;br /&gt; Console.WriteLine( "\nClass\n" );&lt;br /&gt; MyClass obj1=new MyClass( );&lt;br /&gt;&lt;br /&gt; obj1.Member="Initialized";&lt;br /&gt;   &lt;br /&gt; // reference(or simply address)of an object stored in obj1 is assigned to &lt;br /&gt;&lt;br /&gt;obj2.&lt;br /&gt; MyClass obj2=obj1;//   stmt --&gt; [B]&lt;br /&gt;  &lt;br /&gt; //obj1 &amp; obj2 are 2 reference variables in the stack.They points to a &lt;br /&gt;&lt;br /&gt;single object &lt;br /&gt; //in the heap.So obj1.str &amp; obj2.str represent same memory location in the heap. &lt;br /&gt; Console.WriteLine( obj1.Member+"\n"+obj2.Member );&lt;br /&gt; Console.WriteLine( "---------------" );&lt;br /&gt;&lt;br /&gt; obj1.Member="Assigned";   &lt;br /&gt; Console.WriteLine( obj1.Member+"\n"+obj2.Member ); &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public struct MyStruct&lt;br /&gt;{ &lt;br /&gt;    string str;&lt;br /&gt;    public string Member&lt;br /&gt;    {&lt;br /&gt; get&lt;br /&gt; {&lt;br /&gt;     return str;&lt;br /&gt; }&lt;br /&gt; set&lt;br /&gt; {&lt;br /&gt;     str=value;&lt;br /&gt; }&lt;br /&gt;    }        &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class MyClass&lt;br /&gt;{ &lt;br /&gt;    string str;&lt;br /&gt;    public string Member&lt;br /&gt;    {&lt;br /&gt; get&lt;br /&gt; {&lt;br /&gt;     return str;&lt;br /&gt; }&lt;br /&gt; set&lt;br /&gt; {&lt;br /&gt;     str=value;&lt;br /&gt; }&lt;br /&gt;     } &lt;br /&gt;}&lt;br /&gt;Output:&lt;br /&gt;Struct&lt;br /&gt;&lt;br /&gt;Initialized&lt;br /&gt;Initailized&lt;br /&gt;---------------&lt;br /&gt;Assigned&lt;br /&gt;Initailized&lt;br /&gt;&lt;br /&gt;Class&lt;br /&gt;&lt;br /&gt;Initialized&lt;br /&gt;Initailized&lt;br /&gt;---------------&lt;br /&gt;Assigned&lt;br /&gt;Assigned&lt;br /&gt;&lt;br /&gt;Summary:&lt;br /&gt;&lt;br /&gt;Through this article I tried to enumerate certain differences of Classes and &lt;br /&gt;&lt;br /&gt;Structures in C#.&lt;br /&gt;&lt;br /&gt;In the Sample Code: I have made an attempt to show the difference in output &lt;br /&gt;when similar statements are executed, first time for a struct( in stmt --&gt; [A] ) and second &lt;br /&gt;&lt;br /&gt;time for a&lt;br /&gt;class( in stmt --&gt; [B] ).&lt;br /&gt;&lt;br /&gt;If you have any suggestions or found any errors in this article, please mail me.&lt;br /&gt;&lt;br /&gt;Question&lt;br /&gt;What is the difference between abstraction and encapsulation? &lt;br /&gt;[edit]&lt;br /&gt;Answer&lt;br /&gt;Abstraction: In bare terms it means “Understanding”. Better understanding of the system leads to good solution. &lt;br /&gt;Data Abstraction: Data Abstraction (In OOP also known as Object Abstraction) purely talks about the understanding of the Developer about the system that is specific to the given DATA. &lt;br /&gt;So there can be Levels of Abstraction to understand the system which differs from developer to developer. Better systems can be developed with higher levels of abstraction. &lt;br /&gt;Difference: Encapsulation is the deliverables of Abstraction. Encapsulation barely talks about grouping up your abstraction to suit the developer needs. Abstraction solves the problem in the design side while encapsulation is the implementation&lt;br /&gt;Property in C# class &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Property in C# class &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How do you access member variables of any class from outside the class ? In most of the languages including C++ , you will make the member variables public so that you can create an instance of the class and directly access the public fields, as shown below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class Car&lt;br /&gt;{&lt;br /&gt; // private fields.&lt;br /&gt; public string color;&lt;br /&gt;&lt;br /&gt; // constructor&lt;br /&gt; public Car()&lt;br /&gt; {&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above class has one public field : color. You may access this field from outside the class as shown below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Car car = new Car();&lt;br /&gt;&lt;br /&gt;car.color = "red";&lt;br /&gt;&lt;br /&gt;string color = car.color;&lt;br /&gt;&lt;br /&gt;But this is the old way ! This would still work with C#, but the suggested approach is to use "Property" instead of directly accessing member variables.&lt;br /&gt;&lt;br /&gt;The following code snippet shows how to create "Property" in a class.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class Car&lt;br /&gt;{&lt;br /&gt; // private fields.&lt;br /&gt; private string color;&lt;br /&gt;&lt;br /&gt; // constructor&lt;br /&gt; public Car()&lt;br /&gt; {&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public string Color&lt;br /&gt; {&lt;br /&gt;  get&lt;br /&gt;  {&lt;br /&gt;   return color; // return the value from privte field.&lt;br /&gt;  }&lt;br /&gt;  set&lt;br /&gt;  {&lt;br /&gt;   color = value; // save value into private field.&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above class has one private field - color. Then we have one "Property" called 'Color', which is used to represent the private field. Note that the field is private and the Property is public. (We have used the same name with upper/lower case to represent the 'Property' and 'field', but you may give any name you want.)&lt;br /&gt;&lt;br /&gt;Each property has two parts :&lt;br /&gt;·  get&lt;br /&gt;·  set&lt;br /&gt;&lt;br /&gt;The get part is executed when you access the value of the Property as shown below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Car car = new Car();&lt;br /&gt;&lt;br /&gt;string color = car.Color;&lt;br /&gt;&lt;br /&gt;When executed, the above get accessor will return the value stored in the field 'color'.&lt;br /&gt;The set part is executed when you assign a value to the Property as shown below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Car car = new Car();&lt;br /&gt;&lt;br /&gt;car.Color = "RED";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When executed, the above set accessor will assign the value "RED" to the private field 'color'. (Note that'value' is a keyword, which will have the value assigned to it.) &lt;br /&gt;So, what is the difference ?&lt;br /&gt;&lt;br /&gt;On the first look, there is no difference! You can achieve the same behaviour by writing 2 different methods ( like SetColor(...), GetColor() ).&lt;br /&gt;First advantage of using property is, code looks cleaner than having 2 separate methods. You can simply call a property as if it was a field in the class Well, then you may ask why make it 2 methods, we can make it a public field, so that we can access it by creating an instance of the class.&lt;br /&gt;The main advantage over using a Property instead of a public field is, with the property, you will get a chance to write few lines of code (if you want) in the get and set accessors. So, you can perform some validation or any other logic before returning any values or assigning to the private field.&lt;br /&gt;&lt;br /&gt;See the modifed class below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class Car&lt;br /&gt;{&lt;br /&gt; // private fields.&lt;br /&gt;  private string color;&lt;br /&gt;&lt;br /&gt; // constructor&lt;br /&gt; public Car()&lt;br /&gt; {&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public string Color&lt;br /&gt; {&lt;br /&gt;  get&lt;br /&gt;  {&lt;br /&gt;   if ( color == "" ) &lt;br /&gt;    return "GREEN";&lt;br /&gt;   else&lt;br /&gt;    return color;&lt;br /&gt;  }&lt;br /&gt;  set&lt;br /&gt;  {&lt;br /&gt;   if ( value == "" )&lt;br /&gt;    thrown new Exception ("Wrong value.");&lt;br /&gt;   else&lt;br /&gt;    color = value;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Let us analyze the get part first. Here we are checking whether there is a valid value in the field 'color' before we return the value. If it is empty, we are getting a chance to return a default value 'Green'. This way, we can make sure that whoever calls the property 'Color' will always get a valid color, never an empty string.&lt;br /&gt;&lt;br /&gt;In the set part, we are doing a validation to make sure we always assign a a valid value to our field. If someone assign an empty string to the 'Color' property, he will get an exception (error).&lt;br /&gt;&lt;br /&gt;Car car = new Car();&lt;br /&gt;&lt;br /&gt;car.Color = "";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The above code will throw an error because we are trying to assign an empty string and the set accessor will throw an error if it an empty string. This way, we can make sure that we allow only valid values to be assigned. &lt;br /&gt;So, i guess now you would appreciate the purpose of "Property". So, no more public fields! Always have private fields and write public properties as wrapper for them if required to expose them to outside the class.&lt;br /&gt;Re: What are the access-specifiers available in c#? Answer&lt;br /&gt;# 1 &lt;br /&gt;The access-specifiers available in C# are:&lt;br /&gt;&lt;br /&gt;1. public - The member can be accessed from anywhere&lt;br /&gt;2. internal - The member can only be accessed from type it&lt;br /&gt;originates from or other types in the same assembly&lt;br /&gt;3. protected - The member can only be accessed from the type&lt;br /&gt;it originates from or from detrieved types of the&lt;br /&gt;originating type&lt;br /&gt;4. protected internal - implies protected OR internal ( not&lt;br /&gt;protected AND internal )&lt;br /&gt;5. private - The member is only accessible by other members&lt;br /&gt;within the type it originates from.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What is GAC? &lt;br /&gt;A shared assembly has version constraints. It is stored in the Global Assembly Cache (GAC). GAC is a repository of shared assemblies maintained by the .NET runtime. The shared assemblies may be used by many applications. To make an assembly a shared assembly, it has to be strongly named. &lt;br /&gt;&lt;br /&gt;To know more on how to share an assembly, create a strongly named assembly Click Here &lt;br /&gt;&lt;br /&gt;GAC is located at C:\Windows\Assembly OR C:\Winnt\Assembly &lt;br /&gt;&lt;br /&gt;How to share an assembly? How to make it strongly named? What is SN.EXE? &lt;br /&gt;In order to share an assembly with many applications, it must have a strong name. &lt;br /&gt;&lt;br /&gt;In order to convert a private assembly to a shared assembly, i.e. to create a strongly named assembly, follow the steps below... &lt;br /&gt;1) Create a strong key using the sn.exe tool. This is used to created a cryptographic key pair. The key pair that is generated by the Strong Name tool can be kept in a file or we can store it our your local machine's Crytographic Service Provider (CSP). For this, goto the .NET command interpreter, and type the following... &lt;br /&gt;&lt;br /&gt;sn -k C:\samplekey.snk &lt;br /&gt;&lt;br /&gt;This will create a strong key and save it to the location C:\samplekey.snk &lt;br /&gt;&lt;br /&gt;2) If the key is stored in a file, just like we have done above, we use the attribute AssemblyKeyFileAttribute. This belongs to the namespace System.Reflection.AssemblyKeyFileAttribute. &lt;br /&gt;&lt;br /&gt;If the key was in the CSP, we would make use of System.Reflection.AssemblyKeyNameAttribute. &lt;br /&gt;&lt;br /&gt;Go to the assemblyinfo.vb file of your project. Open this file. Make the following changes in this file... &lt;br /&gt;&lt;br /&gt;&lt;assembly: assemblykeyfileattribute("C:\samplekey.snk")&gt; &lt;br /&gt;&lt;br /&gt;We may write this in our code as well, like this... &lt;br /&gt;&lt;br /&gt;Imports System.Reflection&lt;br /&gt;&lt;assembly: assemblykeyfileattribute("C:\samplekey.snk")&gt;&lt;br /&gt;Namespace StrongName&lt;br /&gt;   Public class Sample&lt;br /&gt;   End Class&lt;br /&gt;End Namespace&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3) Build your project. Your assembly is now strongly named. &lt;br /&gt;&lt;br /&gt;Installing the Shared assembly in GAC... &lt;br /&gt;Go to .NET command interpreter, use the tool gacutil.exe &lt;br /&gt;Type the following... &lt;br /&gt;gacutil /i sampleclass.dll To uninstall it, use... gacutil /u sampleclass.dll Visual Studio.NET provides a GUI tool for viewing all shared assemblies in the GAC. &lt;br /&gt;&lt;br /&gt;Folder of GAC: C:\Windows\Assembly OR C:\Winnt\Assembly&lt;br /&gt;&lt;br /&gt;what is the difference between dataset and datareader?&lt;br /&gt;DataReader:&lt;br /&gt;DataReader is purely connection oriented. It will make use connection exclusively. When we close the DataReader then the connection will be released so that it can be used for other purpose.&lt;br /&gt;When the application requires only reading data only once then we have to choose DataReader. DataReader will consume only one record memory space in the client application process.&lt;br /&gt;&lt;br /&gt;Dataset:&lt;br /&gt;It can be defined as a "In memory database for the client application. This will maintain collection of tables called as data tables.&lt;br /&gt;Dataset is purely disconnected&lt;br /&gt;&lt;br /&gt;Dataset acts as an in memory database.&lt;br /&gt;It's connection less.&lt;br /&gt;Can edit ,apply relations using dataset Data reader has no such facility&lt;br /&gt;DataReader is Connection Oriented&lt;br /&gt;Readonly farword only&lt;br /&gt;&lt;br /&gt;Data Reader:-&lt;br /&gt;Data Reader is a read only and forward only data&lt;br /&gt;You can access one table at a time.&lt;br /&gt;Data reader cant persist the data.&lt;br /&gt;Data Reader is connected architecture.&lt;br /&gt;Data Reader is faster than Data Adapter&lt;br /&gt;Data Reader is faster than dataset operation&lt;br /&gt;Data Set:&lt;br /&gt;Data Set is disconnected architecture.&lt;br /&gt;Data Set is persist the data.&lt;br /&gt;You can access more than one table&lt;br /&gt;Data Set is main for storage tool in ADO.Net&lt;br /&gt;&lt;br /&gt;Hi,&lt;br /&gt;&lt;br /&gt;Difference between them are as follows:&lt;br /&gt;&lt;br /&gt;1&gt;Dataset works on disconnected architecture whereas datareader works on connected architecture.&lt;br /&gt;&lt;br /&gt;2&gt;Dataset is scrollable whereas datareader is forward only record set.&lt;br /&gt;&lt;br /&gt;3&gt;We can create relations in dataset whereas we can't create relation in datareader.&lt;br /&gt;&lt;br /&gt;4&gt;Dataset supports integeration with XML whereas Datareader doesn't support.&lt;br /&gt;&lt;br /&gt;5&gt;Dataset communicates with the dataadapter only whereas datareader communicates with the command object.&lt;br /&gt;&lt;br /&gt;Thanks and Regards&lt;br /&gt;S.S.Bajoria&lt;br /&gt;DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it's forward only type). Reader is best fit to show the Data (where no need to work on data)&lt;br /&gt;DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data.&lt;br /&gt;· &lt;br /&gt;· AdSense Revenue&lt;br /&gt;&lt;br /&gt;Gifts &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Active Members &lt;br /&gt;Today&lt;br /&gt;· ANIL PANDEY (190)&lt;br /&gt;· Pradeep Kintal... (144)&lt;br /&gt;· abhay (81)&lt;br /&gt;Last 7 Days&lt;br /&gt;· Satyanarayan Su... (1086)&lt;br /&gt;· ANIL PANDEY (1031)&lt;br /&gt;· Ravi Kiran ... (531)&lt;br /&gt;more...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;differences b/w connected and disconnected archetecture&lt;br /&gt;Following are some major differences between both&lt;br /&gt;v As in classic ADO we had client and server side cursors they are no more&lt;br /&gt;present in ADO.NET. Note it's a disconnected model so they are no more&lt;br /&gt;applicable.&lt;br /&gt;v Locking is not supported due to disconnected model.&lt;br /&gt;v All data persist in XML as compared to classic ADO where data&lt;br /&gt;persisted in Binary format also.&lt;br /&gt;Read Foll very carefully&lt;br /&gt;&lt;br /&gt;DATA Reader&lt;br /&gt;The DataReader has a defined set of operations that revolve&lt;br /&gt;around its connected, forward-only, read-only nature (the&lt;br /&gt;read-only DataReader is also known as the firehose cursor of&lt;br /&gt;ADO.NET). A DataReader is a stream of data that is returned&lt;br /&gt;from a database query. When the query is executed, the first&lt;br /&gt;row is returned to the DataReader via the stream. The stream&lt;br /&gt;then remains connected to the database, poised to retrieve&lt;br /&gt;the next record. The DataReader reads one row at a time from&lt;br /&gt;the database and can only move forward, one record at a&lt;br /&gt;time. As the DataReader reads the rows from the database,&lt;br /&gt;the values of the columns in each row can be read and&lt;br /&gt;evaluated, but they cannot be edited.&lt;br /&gt;&lt;br /&gt;DATA Adapter&lt;br /&gt;The DataSet is the main data storage tool in the ADO.NET&lt;br /&gt;disconnected architecture. Unlike the DataReader, the&lt;br /&gt;DataSet is not connected directly to a database through a&lt;br /&gt;Connection object when you populate it. Instead, to fill a&lt;br /&gt;DataSet from a database you first create a DataAdapter&lt;br /&gt;object (such as a SqlDataAdapter) for the provider and&lt;br /&gt;associate it with a SqlConnection object. Then the&lt;br /&gt;SqlDataAdapter can broker the data retrieval for the DataSet&lt;br /&gt;by issuing a SqlCommand against the database through the&lt;br /&gt;SqlConnection, retrieving the data, and filling the DataSet.&lt;br /&gt;&lt;br /&gt;You can think of the SqlDataAdapter as a bridge between the&lt;br /&gt;connected and disconnected objects. One of its purposes is&lt;br /&gt;to serve as the route for a rowset to get from the database&lt;br /&gt;to the DataSet. For example, when the SqlDataAdapter's Fill&lt;br /&gt;method is executed it opens its associated SqlConnection&lt;br /&gt;object (if not already open) and issues its associated&lt;br /&gt;SqlCommand object against the SqlConnection. Behind the&lt;br /&gt;scenes, a SqlDataReader is created implicitly and the rowset&lt;br /&gt;is retrieved one row at a time in succession and sent to the&lt;br /&gt;DataSet. Once all of the data is in the DataSet, the&lt;br /&gt;implicit SqlDataReader is destroyed and the SqlConnection is&lt;br /&gt;closed.&lt;br /&gt;when we discus on connected and disconnect architecture&lt;br /&gt;then two term open one os dataset and another is datareader&lt;br /&gt;&lt;br /&gt;A DataReader is a read-only stream of data returned from the database as the query executes. It only contains one row of data in memory at a time and is restricted to navigating forward only in the results one record at a time. The DataReader does support access to multiple result sets, but only one at a time and in the order retrieved. Just as in the original version of ADO, the data is no longer available through the DataReader once the connection to the data source is closed, which means a DataReader requires a connection to the database throughout its usage. Output parameters or return values are only available through the DataReader once the connection is closed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DataSet is the core of the ADO.NET disconnected architecture and is used to store data in a disconnected state.&lt;br /&gt;NFS&lt;br /&gt;Normalization:&lt;br /&gt;In relational database design, the process of organizing data to minimize redundancy. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.&lt;br /&gt;&lt;br /&gt;There are three main normal forms, each with increasing levels of normalization:&lt;br /&gt;&lt;br /&gt;First Normal Form (1NF): Each field in a table contains different information. For example, in an employee list, each table would contain only one birthdate field.&lt;br /&gt;Second Normal Form (2NF): Each field in a table that is not a determiner of the contents of another field must itself be a function of the other fields in the table.&lt;br /&gt;Third Normal Form (3NF): No duplicate information is permitted. So, for example, if two tables both require a birthdate field, the birthdate information would be separated into a separate table, and the two other tables would then access the birthdate information via an index field in the birthdate table. Any change to a birthdate would automatically be reflect in all tables that link to the birthdate table.&lt;br /&gt;There are additional normalization levels, such as Boyce Codd Normal Form (BCNF), fourth normal form (4NF) and fifth normal form (5NF). While normalization makes databases more efficient to maintain, they can also make them more complex because data is separated into so many different tables.&lt;br /&gt;There are 5 normal forms. &lt;br /&gt;&lt;br /&gt;It is necessary for any database to be in the third normal form to maintain referential integrity and non-redundance.&lt;br /&gt;&lt;br /&gt;First Normal Form: Every field of a table (row,col) must contain an atomic value&lt;br /&gt;&lt;br /&gt;Second Normal Form: All columns of a table must depend entirely on the primary key column.&lt;br /&gt;&lt;br /&gt;Third Normal Form: All columns of a table must depend on all columns of a composite primary key.&lt;br /&gt;&lt;br /&gt;Fourth Normal Form: A table must not contain two or more independent multi-valued facts. This normal form is often avoided for maintenance reasons.&lt;br /&gt;&lt;br /&gt;Fifth Normal Form: is about symmetric dependencies.&lt;br /&gt;Each normal form assumes that the table is already in the earlier normal form.&lt;br /&gt;NORMALIZATION is a body of rules addressing analysis and conversion of data structures into relations that exhibit more desirable properties of internal consistency,minimal redundancy and maximum stability.&lt;br /&gt;&lt;br /&gt;What is the difference between abstract class and interface?&lt;br /&gt;If a class is to serve the purpose of providing common fields and members to all subclasses, we create an Abstract class. For creating an abstract class, we make use of the abstract keyword. Such a class cannot be instantiated. Syntax below: &lt;br /&gt;abstract public class Vehicle { } &lt;br /&gt;Above, an abstract class named Vehicle has been defined. We may use the fields, properties and member functions defined within this abstract class to create child classes like Car, Truck, Bike etc. that inherit the features defined within the abstract class. To prevent directly creating an instance of the class Vehicle, we make use of the abstract keyword. To use the definitions defined in the abstract class, the child class inherits from the abstract class, and then instances of the Child class may be easily created.&lt;br /&gt;Further, we may define abstract methods within an abstract class (analogous to C++ pure virtual functions) when we wish to define a method that does not have any default implementation. Its then in the hands of the descendant class to provide the details of the method. There may be any number of abstract methods in an abstract class. We define an abstract method using the abstract keyword. If we do not use the abstract keyword, and use the virtual keyword instead, we may provide an implementation of the method that can be used by the child class, but this is not an abstract method.&lt;br /&gt;Remember, abstract class can have an abstract method, that does not have any implementation, for which we use the abstract keyword, OR the abstract class may have a virtual method, that can have an implementation, and can be overriden in the child class as well, using the override keyword. Read example below &lt;br /&gt;Example: Abstract Class with Abstract method&lt;br /&gt;namespace Automobiles&lt;br /&gt;{&lt;br /&gt; public abstract class Vehicle&lt;br /&gt; {&lt;br /&gt;  public abstract void Speed() //No Implementation here, only definition&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Example: Abstract Class with Virtual method&lt;br /&gt;namespace Automobiles&lt;br /&gt;{&lt;br /&gt; public abstract class Vehicle&lt;br /&gt; {&lt;br /&gt;  public virtual void Speed() //Can have an implementation, that may be overriden in child class&lt;br /&gt;  { &lt;br /&gt;   ...&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;Public class Car : Vehicle&lt;br /&gt;{&lt;br /&gt;Public override void Speed() &lt;br /&gt;//Here, we override whatever implementation is there in the abstract class &lt;br /&gt; {&lt;br /&gt;   ... //Child class implementation of the method Speed()&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;An Interface is a collection of semantically related abstract members. An interface expresses through the members it defines, the behaviors that a class needs to support. An interface is defined using the keyword interface. The members defined in an interface contain only definition, no implementation. The members of an interface are all public by default, any other access specifier cannot be used. See code below: &lt;br /&gt;Public interface IVehicle //As a convention, an interface is prefixed by letter I&lt;br /&gt;{&lt;br /&gt;  Boolean HasFourWheels()&lt;br /&gt;}&lt;br /&gt;Time to discuss the Difference between Abstract Class and Interface&lt;br /&gt;&lt;br /&gt;1) A class may inherit only one abstract class, but may implement multiple number of Interfaces. Say a class named Car needs to inherit some basic features of a vehicle, it may inherit from an Aabstract class named Vehicle. A car may be of any kind, it may be a vintage car, a sedan, a coupe, or a racing car. For these kind of requirements, say a car needs to have only two seats (means it is a coupe), then the class Car needs to implement a member field from an interface, that we make, say ICoupe.&lt;br /&gt;2) Members of an abstract class may have any access modifier, but members of an interface are public by default, and cant have any other access modifier.&lt;br /&gt;3) Abstract class methods may OR may not have an implementation, while methods in an Interface only have a definition, no implementation. &lt;br /&gt;Basic ADO.NET objects&lt;br /&gt; &lt;br /&gt;Figure 2-1.   How ADO.NET works&lt;br /&gt;Description &lt;br /&gt;· ADO.NET uses two types of objects to access the data in a database: datasets, which can contain one or more data tables, and .NET data provider objects, which include data adapters, commands, and connections. &lt;br /&gt;· A dataset stores data from the database so that it can be accessed by the application. The .NET data provider objects retrieve data from and update data in the database. &lt;br /&gt;· To retrieve data from a database and store it in a data table, a data adapter object issues a Select statement that’s stored in a command object. Next, the command object uses a connection object to connect to the database and retrieve the data. Then, the data is passed back to the data adapter, which stores the data in the dataset. &lt;br /&gt;· To update the data in a database based on the data in a data table, the data adapter object issues an Insert, Update, or Delete statement that’s stored in a command object. Then, the command object uses a connection to connect to the database and update the data. &lt;br /&gt;· The data provider remains connected to the database only long enough to retrieve or update the specified data. Then, it disconnects from the database and the application works with the data via the dataset object. This is referred to as a disconnected data architecture. &lt;br /&gt;· All of the ADO.NET objects are implemented by classes in the System.Data namespace of the .NET Framework. However, the specific classes used to implement the connection, command, and data adapter objects depend on the .NET data provider you use. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Common Language Runtime (CLR)&lt;br /&gt;&lt;br /&gt;The .NET Framework provides a Runtime environment called the Common Language Runtime or (CLR) that handles the execution of the code and provides useful services for the implementation of the application. CLR takes care of code management upon program execution and provides various services such as memory management, thread management, security management and other system services. The managed code targets CLR benefits by using useful features such as cross-language integration, cross-language exception handling, versioning, enhanced security, deployment support, and debugging. It is a framework layer that resides above the Operating System. .Net programs don’t directly communicate with the Operating System but through CLR.&lt;br /&gt;&lt;br /&gt;Common Language Specification (CLS)&lt;br /&gt;&lt;br /&gt;Earlier we used the term ‘.NET Compliant Language’ and stated that all the .NET compliant languages can make use of CLR and FCL. But what makes a language ‘.NET compliant language’? The answer is Common Language Specification (CLS). Microsoft has released a small set of specification that each language should meet to qualify as a .NET Compliant Language. As IL is a very rich language, it is not necessary for a language to implement all the IL functionality, rather it meets the small subset of it, CLS, to qualify as a .NET compliant language, which is the reason why so many languages (procedural and OO) are now running under .Net umbrella. CLS basically addresses to language design issues and lays certain standards like there should be no global function declaration, no pointers, no multiple inheritance and things like that. The important point to note here is that if you keep your code within CLS boundary, your code is guaranteed to be usable in any other .Net language.&lt;br /&gt;&lt;br /&gt;Common Type System (CTS)&lt;br /&gt;&lt;br /&gt;.NET also defines a Common Type System (CTS). Like CLS, CTS is also a set of standards. CTS defines the basic data types that IL understands. Each .NET compliant language should map its data types to these standard data types. This makes it possible for the 2 languages to communicate with each other by passing/receiving parameters to/from each other. For example, CTS defines a type Int32, an integral data type of 32 bits (4 bytes) which is mapped by C# through int and VB.Net through its Integer data type.&lt;br /&gt;&lt;br /&gt;Hope it helps. &lt;br /&gt;Biography&lt;br /&gt;Asp.Net Developer&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-4478112611845337931?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/4478112611845337931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=4478112611845337931' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/4478112611845337931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/4478112611845337931'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/dotintevriew-preperation.html' title='DotIntevriew preperation'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-990480854764069314</id><published>2008-09-26T06:30:00.000-07:00</published><updated>2008-09-26T07:20:11.231-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new1'/><title type='text'>name1</title><content type='html'>&lt;meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"&gt;&lt;title&gt;&lt;/title&gt;&lt;meta name="GENERATOR" content="OpenOffice.org 2.3  (Win32)"&gt;&lt;style type="text/css"&gt; 	&lt;!-- 		@page { size: 8.5in 11in; margin: 0.79in } 		P { margin-bottom: 0.08in } 	--&gt; 	&lt;/style&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is an abstract class, and when should it be used?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Let's look at an example of an abstract class, and an abstract method.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Suppose we were modeling the behavior of animals, by creating a class hierachy that started with a base class called Animal. Animals are capable of &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;doing different things like flying, digging and walking, but there are some common operations as well like eating and sleeping. Some common operations &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;are performed by all animals, but in a different way as well. When an operation is performed in a different way, it is a good candidate for an abstract &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;method (forcing subclasses to provide a custom implementation). Let's look at a very primitive Animal base class, which defines an abstract method for &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;making a sound (such as a dog barking, a cow mooing, or a pig oinking). &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public abstract Animal&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public void eat(Food food)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;// do something with food.... &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public void sleep(int hours)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;try&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;	{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;		// 1000 milliseconds * 60 seconds * 60 minutes * hours&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;		Thread.sleep ( 1000 * 60 * 60 * hours);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;	}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;	catch (InterruptedException ie) { /* ignore */ } &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public abstract void makeNoise();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Note that the abstract keyword is used to denote both an abstract method, and an abstract class. Now, any animal that wants to be instantiated (like a dog&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;or cow) must implement the makeNoise method - otherwise it is impossible to create an instance of that class. Let's look at a Dog and Cow subclass that&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;extends the Animal class.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public Dog extends Animal&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public void makeNoise() { System.out.println ("Bark! Bark!"); }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public Cow extends Animal&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public void makeNoise() { System.out.println ("Moo! Moo!"); }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Now you may be wondering why not declare an abstract class as an interface, and have the Dog and Cow implement the interface.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Sure you could - but you'd also need to implement the eat and sleep methods. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;By using abstract classes, you can inherit the implementation of other (non-abstract) methods.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;You can't do that with interfaces - an interface cannot provide any method implementations.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;Boxing and Unboxing in C# .Net&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Introduction&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In this article I will explain the concepts of Boxing and UnBoxing. C# provides us with Value types and Reference Types. Value Types are stored on the stack&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;and Reference types are stored on the heap. The conversion of value type to reference type is known as boxing and converting reference type back to the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;value type is known as unboxing.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Let me explain you little more about Value and Reference Types.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Value Types&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Value types are primitive types that are mapped directly to the FCL. Like Int32 maps to System.Int32, double maps to System.double. All value types are&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;stored on stack and all the value types are derived from System.ValueType. All structures and enumerated types that are derived from System.ValueType&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;are created on stack, hence known as ValueType.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Reference Types&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Reference Types are different from value types in such a way that memory is allocated to them from the heap. All the classes are of reference type.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;C# new operator returns the memory address of the object.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Examples&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Lets see some examples to have a better understanding of Value Types and Reference Types. Since we know that all ValueTypes are derived from &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.Value we can write something like this:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 5;       &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;So what do you think about the above line of code. Will it compile ? Yes it will compile. But wait what type is it cause I don't remember any type&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;which is called System.ValueType since its a base class from which all value types inherit. So is it Int32, Int64,double, decimal etc. It turns out that &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;the type for variable 'r' is System.Int32. The Question arrises why Int32 and why not Int16. Well its because it is mapped to Int32 by default depending &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;upon the Initial value of the variable.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;You cannot write something like this since System.ValueType is not a primitive type its a base class for primitive value types and these mathematical &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;operations can be performed on primitive types.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 10; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;r++;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In the above example I told you that variable 'r' will be a System.Int32 variable but if you don't believe me than you can find out yourself using the&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;GetType() method:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;     &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 5;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;     &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine(r.GetType()) // returns System.Int32; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Here are few samples you can try on your own:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;       &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 23.45; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine(r.GetType()); // what does this print&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//-------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 23.45F; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine(r.GetType()); // What does this print&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//-------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 2U; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine(r.GetType()); // What does this print&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//-------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 'c';&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine(r.GetType()); // What does this print&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//-------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = 'ac';&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine(r.GetType()); // tricky &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//-------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.ValueType r = "Hello World"; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine(r.GetType()); // tricky&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Boxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Lets now jump to Boxing. Sometimes we need to convert ValueTypes to Reference Types also known as boxing. Lets see a small example below. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;You see in the example I wrote "implicit boxing" which means you don't need to tell the compiler that you are boxing Int32 to object because it takes &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;care of this itself although you can always make explicit boxing as seen below right after implicit boxing.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int32 x = 10; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;object o = x ;  // Implicit boxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("The Object o = {0}",o); // prints out 10&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//-----------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int32 x = 10; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;object o = (object) x; // Explicit Boxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("The object o = {0}",o); // prints out 10&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Unboxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Lets now see UnBoxing an object type back to value type. Here is a simple code that unbox an object back to Int32 variable. First we need to box it so &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;that we can unbox.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int32 x = 5; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;object o = x; // Implicit Boxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;x = o; // Implicit UnBoxing     &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;So, you see how easy it is to box and how easy it is to unbox. The above example first boxs Int32 variable to an object type and than simply unbox &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;it to x again. All the conversions are taking place implicitly. Everything seems right in this example there is just one small problem which is that the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;above code is will not compile. You cannot Implicitly convert a reference type to a value type. You must explicitly specify that you are unboxing as &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;shown in the code below.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int32 x = 5; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;object o = x; // Implicit Boxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;x = (Int32)o; // Explicit UnBoxing    &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Lets see another small example of unboxing.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int32 x = 5; // declaring Int32&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int64 y = 0; // declaring Int64 double&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;object o = x; // Implicit Boxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;y = (Int64)o; // Explicit boxing to double&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("y={0}",y);       &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;This example will not work. It will compile successfully but at runtime It will generate an exception of System.InvalidCastException. The reason is &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;variable x is boxed as Int32 variable so it must be unboxed to Int32 variable. So, the type the variable uses to box will remain the same when unboxing &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;the same variable. Of course you can cast it to Int64 after unboxing it as Int32 as follows:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int32 x = 5; // declaring Int32&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Int64 y = 0; // declaring Int64 double&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;object o = x; // Implicit Boxing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;y = (Int64)(Int32)o; // Unboxing and than casting to double&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("y={0}",y);      &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;I am sure that you all have grasp the basic understanding of Boxing and Unboxing. Happy Coding and practice a lot !&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;webFarm Vs webGardens &lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A web farm is a multi-server scenario. So we may have a server in each state of US. If the load on one server is in excess then the other servers step in&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;to bear the brunt. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;How they bear it is based on various models. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;1. RoundRobin. (All servers share load equally) &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;2. NLB (economical) &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;3. HLB (expensive but can scale up to 8192 servers) &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;4. Hybrid (of 2 and 3). &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;5. CLB (Component load balancer). &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A web garden is a multi-processor setup. i.e., a single server (not like the multi server above). &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;How to implement webfarms in .Net: &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Go to web.config and Here for mode = you have 4 options. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;a) Say mode=inproc (non web farm but fast when you have very few customers). &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;b) Say mode=StateServer (for webfarm) &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;c) Say mode=SqlServer (for webfarm) &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Whether to use option b or c depends on situation. StateServer is faster but SqlServer is more reliable and used for mission critical applications. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;How to use webgardens in .Net: &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Go to web.config and Change the false to true. You have one more attribute that is related to webgarden in the same tag called cpuMask. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;OOP &amp;amp; C#&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The skeleton of object - oriented programming is of course the concepts of class. This C# tutorial on OOPS explains classes and their importance in &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;implementation of object ? oriented principles.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Any language can be called object ? oriented if it has data and method that use data encapsulated in items named objects. An object ? oriented&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;programming method has many advantages, some of them are flexibility and code reusability.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;All the programming languages supporting Object oriented Programming will be supporting these three main concepts:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;1. Encapsulation&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;2. Inheritance&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;3. Polymorphism&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Encapsulation in C#:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Encapsulation is process of keeping data and methods together inside objects. In this way developer must define some methods of object?s interaction. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In C# , encapsulation is realized through the classes. A Class can contain data structures and methods. Consider the following class.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public class Aperture&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public Aperture()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;protected double height;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;protected double width;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;protected double thickness;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public double GetVolume()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;            &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;double volume = height*width*thickness;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;            &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;if(volume&lt;0)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;            &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;return 0;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;            &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;return volume;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In this example we encapsulate some data such as height, width, thickness and method GetVolume. Other methods or objects can interact with this&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;object through methods that have public access modifier. It must be done using ?.? operator.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Inheritance in C#:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In a few words, Inheritance is the process of creation new classes from already existing classes. The inheritance feature allows us to reuse some &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;parts of code. So, now we have some derived class that inherits base class?s members. Consider the following code snippet:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public class Door : Aperture&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public Door() : base()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;        &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public bool isOutside = true;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;As you see to inherit one class from another, we need to write base class name after ?:? symbol. Next thing that was done in code Door () ? &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;constructor also inherits base class constructor. And at last we add new private field. All members of Aperture class are also in Door class. We &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;can inherit all the members that has access modifier higher than protected.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Polymorphism in C#:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Polymorphism is possibility to change behavior with objects depending of object?s data type. In C# polymorphism realizes through the using &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;of keyword virtual and override. Let look on the example of code:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public virtual void Out()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;       &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("Aperture virtual method called");&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;} &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//This method is defined in Aperture class. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public override void Out()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;       &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("Door virtual method called");&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Now we need to re-define it in our derived Door class. The usage of virtual methods can be clarified when we creating an instance of derived&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;class from the base class:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Aperture ap = new Door();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ap.Out();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In such cases, the runtime keeps record of all the virtual function details in a table called VMT(Virtual Method Table) and then in runtime&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dynamically picks the correct version of the function to be used. Here it uses Out() method from derived class of course.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;To compile the attached example you need to run .NET console and run the next command: csc filename.cs . &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;ASP.NET Web Parts Overview&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ASP.NET Web Parts is an integrated set of controls for creating Web sites that enable end users&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;to modify the content, appearance, and behavior of Web pages directly from a browser.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.Collections namespace; these classes are used to hold collections of values or objects in memory and are commonly known as arrays. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The three commonly used collection classes are &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ArrayList, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Hashtable and &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;SortedList&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;Create an ArrayList&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The ArrayList object is a collection of items containing a single data value.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Items are added to the ArrayList with the Add() method.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The following code creates a new ArrayList object named mycountries and four items are added:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;script runat="server"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;sub Page_Load&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;if Not Page.IsPostBack then&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dim mycountries=New ArrayList&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("Norway")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("Sweden")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("France")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("Italy")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.TrimToSize()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Sort()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dd.DataSource=mycountries&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dd.DataBind()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end if&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;sub displayMessage(s as Object,e As EventArgs)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;lbl1.text="Your favorite country is: " &amp;amp; dd.SelectedItem.Text&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;form runat="server"&gt;&lt;/form&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;asp:dropdownlist id="dd" runat="server"&gt;&lt;/asp:dropdownlist&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;AutoPostBack="True" onSelectedIndexChanged="displayMessage" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;p&gt;&lt;asp:label id="lbl1" runat="server"&gt;&lt;/asp:label&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The Hashtable object contains items in key/value pairs. The keys are used as indexes, and very quick searches can be made for values by searching &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;through their keys.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Items are added to the Hashtable with the Add() method.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;EXAMPLE:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;script runat="server"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;sub Page_Load&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;if Not Page.IsPostBack then&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dim mycountries=New Hashtable&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("N","Norway")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("S","Sweden")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("F","France")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("I","Italy")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;rb.DataSource=mycountries&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;rb.DataValueField="Key"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;rb.DataTextField="Value"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;rb.DataBind()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end if&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end subsub displayMessage(s as Object,e As EventArgs)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;lbl1.text="Your favorite country is: " &amp;amp; rb.SelectedItem.Text&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;form runat="server"&gt;&lt;/form&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;asp:radiobuttonlist id="rb" runat="server"&gt;&lt;/asp:radiobuttonlist&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;AutoPostBack="True" onSelectedIndexChanged="displayMessage" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;p&gt;&lt;asp:label id="lbl1" runat="server"&gt;&lt;/asp:label&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The SortedList object contains items in key/value pairs. A SortedList object automatically sort the items in alphabetic or numeric order.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Items are added to the SortedList with the Add() method. A SortedList can be sized to its final size with the TrimToSize() method.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The following code creates a SortedList named mycountries and four elements are added:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;script runat="server"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;sub Page_Load&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;if Not Page.IsPostBack then&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dim mycountries=New SortedList&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("N","Norway")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("S","Sweden")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("F","France")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;mycountries.Add("I","Italy")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dd.DataSource=mycountries&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dd.DataValueField="Key"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dd.DataTextField="Value"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;dd.DataBind()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end if&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;sub displayMessage(s as Object,e As EventArgs)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;lbl1.text="Your favorite country is: " &amp;amp; dd.SelectedItem.Text&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;end sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana, sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;form runat="server"&gt;&lt;/form&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;asp:dropdownlist id="dd" runat="server"&gt;&lt;/asp:dropdownlist&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;AutoPostBack="True" onSelectedIndexChanged="displayMessage" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;p&gt;&lt;asp:label id="lbl1" runat="server"&gt;&lt;/asp:label&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;Maintaining the ViewState&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a form with a lot of information and the server&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;comes back with an error. You will have to go back to the form and correct the information. You click the back button, and what happens.......&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your ViewState.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. How come? This is because ASP .NET &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;maintains your ViewState. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;placed on each page with a &lt;form runat="server"&gt; control. The source could look something like this:&lt;/form&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;input name="__VIEWSTATE" type="hidden"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;value="dDwtNTI0ODU5MDE1Ozs+ZBCF2ryjMpeVgUrY2eTj79HNl4Q=" /&gt;.....some code&lt;/span&gt; &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;Validation Server Controls&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A Validation server control is used to validate the data of an input control. If the data does not pass validation, it will display an error message to the user.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color rgb(0, 0, 0); border-width: medium medium 1px; padding: 0in 0in 0.03in; margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Validation Server Control 	            &lt;u&gt;D&lt;/u&gt;escription &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;CompareValidator 			Compares the value of one input control to the value of another input control or to a fixed value &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;CustomValidator 				Allows you to write a method to handle the validation of the value entered &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;RangeValidator 				Checks that the user enters a value that falls between two values &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;RegularExpressionValidator 			Ensures that the value of an input control matches a specified pattern&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;RequiredFieldValidator 			Makes an input control a required field &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ValidationSummary 			Displays a report of all validation errors occurred in a Web page &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;AJAX = Asynchronous JavaScript and XML&lt;/b&gt;&lt;span style=""&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;AJAX is not a new programming language, but a technique for creating better, faster, and more interactive web applications.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;With AJAX, your JavaScript can communicate directly with the server, using the JavaScript XMLHttpRequest object. With this object, your JavaScript can&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;trade data with a web server, without reloading the page.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;from the server instead of whole pages.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The AJAX technique makes Internet applications smaller, faster and more user-friendly.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;AJAX is a browser technology independent of web server software.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;AJAX Uses HTTP Requests&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;	In traditional JavaScript coding, if you want to get any information from a database or a file on the server, or send user &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;information to a server, you will have to make an HTML form and GET or POST data to the server. The user will have to click the "Submit" button to &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;send/get the information, wait for the server to respond, then a new page will load with the results.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Because the server returns a new page each time the user submits input, traditional web applications can run slowly and tend to be less user-friendly.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;With AJAX, your JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;With an HTTP request, a web page can make a request to, and get a response from a web server - without reloading the page. The user will stay on the&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;same page, and he or she will not notice that scripts request pages, or send data to a server in the background.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;b&gt;What is Difference Between Interface and abstract Class &lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Interface :&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;1.Interface have only Signature.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;2.All the Methods are Public , It doesn't have access Modifier Controls&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;3.It have used Multiple inheritence in the Object oriented Language&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;4.All the Methods are Abstract.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;5.It does not have Contructor,destructor,Fileds&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;6.A Class May inherits several Interfaces&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Abstract Class:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;1.Abstract Class have Method defination and Implementation&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;2.It have control the Access Modifiers&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;3.It does not allow multiple Inheritence&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;4.Some methods are concrete&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;5. It have Contructor and destructor&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;6.Only one abstract have to derived &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is the difference between a DLL and an EXE?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In .NET, an assembly may become a DLL or an EXE. Yet, there is a major underlying difference&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;between the two. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;An EXE is an executable file, that may run on its own. Its independant. Where as a DLL is a &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Dynamic Link Library, that binds to an exe, or another DLL at runtime. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A DLL has an exposed interface, through which members of the assembly may be accessed &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;by those objects that require it. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A DLL runs in tandem with the application space in memory, as the application references it. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Whereas an EXE is independant, and runs as an independant process. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Structures and Enumerations are Value-Types.&lt;/b&gt; This means, the data that they contain is stored&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;as a stack on the memory. Classes are Reference-Types, means they are stored as a heap on &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;the memory.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Structures are implicitly derived from a class called System.ValueType. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The purpose of System.ValueType is to override the virtual methods defined by &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;System.Object. So when the runtime encounters a type derived from System.ValueType, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;then stack allocation is achieved. When we allocate a structure type, we may also use the&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;new keyword. We may even make a constructor of a structure, but, remember, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A No-argument constructor for a structure is not possible. The structure's constructor should &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;always have a parameter. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is the difference between String and StringBuilder? &lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Both String and StringBuilder are classes used to handle strings.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The most common operation with a string is concatenation. This activity has to be performed&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;very efficiently. When we use the "String" object to concatenate two strings, the first string is&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;combined to the other string by creating a new copy in the memory as a string object, and &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;then the old string is deleted. This process is a little long. Hence we say "Strings are immutable".&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;When we make use of the "StringBuilder" object, the Append method is used. This means, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;an insertion is done on the existing string. Operation on StringBuilder object is faster than&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;String operations, as the copy is done to the same location. Usage of StringBuilder is more&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;efficient in case large amounts of string manipulations have to be performed. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is the difference between Server.Transfer and Response.Redirect? &lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Both "Server" and "Response" are objects of ASP.NET. Server.Transfer and Response.Redirect both are used to transfer a user from one page to another. But there is an underlying difference.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//Usage of Server.Transfer &amp;amp; Response.Redirect&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Server.Transfer("Page2.aspx"); &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Response.Redirect("Page2.aspx");&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The Response.Redirect statement sends a command back to the browser to request the next &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;page from the server. This extra round-trip is often inefficient and unnecessary, but this&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;established standard works very well. By the time Page2 is requested, Page1 has been&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;flushed from the server’s memory and no information can be retrieved about it unless the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;developer explicitly saved the information using some technique like session, cookie, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;application, cache etc. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The more efficient Server.Transfer method simply renders the next page to the browser&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;without an extra round trip. Variables can stay in scope and Page2 can read properties &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;directly from Page1 because it’s still in memory. This technique would be ideal if it wasn’t &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;for the fact that the browser is never notified that the page has changed. Therefore, the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;address bar in the browser will still show “Page1.aspx” even though the Server.Transfer &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;statement actually caused Page2.aspx to be rendered instead. This may occasionally be &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;a good thing from a security perspective, it often causes problems related to the browser &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;being out of touch with the server. Say, the user reloads the page, the browser will request&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Page1.aspx instead of the true page (Page2.aspx) that they were viewing. In most cases,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Response.Redirect and Server.Transfer can be used interchangeably. But in some cases, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;efficiency or usability may be the deciding factor in choosing. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Static Classes and Static Class Members (C# Programming Guide)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Static classes and class members are used to create data and functions that can be accessed &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;without creating an instance of the class. Static class members can be used to separate data &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;and behavior that is independent of any object identity: the data and functions do not change &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;regardless of what happens to the object. Static classes can be used when there is no data or &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;behavior in the class that depends on object identity.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The main features of a static class are:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;They only contain static members.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;They cannot be instantiated.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;They are sealed.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;They cannot contain Instance Constructors (C# Programming Guide).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Static Members &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A static method, field, property, or event is callable on a class even when no instance of the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;class has been created. If any instances of the class are created, they cannot be used to access &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;the static member. Only one copy of static fields and events exists, and static methods and &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;properties can only access static fields and static events. Static members are often used to &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;represent data or calculations that do not change in response to object state; for instance, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;a math library might contain static methods for calculating sine and cosine.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Static class members are declared using the static keyword before the return type of the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;member&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is the difference between ExecuteScalar and ExecuteNonQuery? What is ExecuteReader? &lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ExecuteScalar - Returns only one value after execution of the query. It returns the first field in &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;the first row. This is very light-weight and is perfect when all your query asks for is one item. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;This would be excellent for receiving a count of records (Select Count(*)) in an sql statement, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;or for any query where only one specific field in one column is required. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ExecuteNonQuery - This method returns no data at all. It is used majorly with Inserts and &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Updates of tables. It is used for execution of DML commands.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Example:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;SqlCommand cmd = new SqlCommand("Insert Into t_SomeTable Values('1','2')",con); &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;//note that con is the connection object&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;con.Open();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;cmd.ExecuteNonQuery(); //The SQL Insert Statement gets executed &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ExecuteReader - This method returns a DataReader which is filled with the data that is retrieved &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;using the command object. This is known as a forward-only retrieval of records. It uses our SQL&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;statement to read through the table from the first to the last record. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is the difference between a DataReader and Dataset in ADO.NET? &lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A DataReader works in a connected environment, whereas DataSet works in a disconnected environment. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A DataReader object represents a forward only, read only access to data from a source.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;It implements IDataReader &amp;amp; IDataRecord interfaces. For example, The SQLDataReader &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;class can read rows from tables in a SQL Server data source. It is returned by the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ExecuteReader method of the SQLCommand class, typically as a result of a SQL Select &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;statement. The DataReader class' HasRows property can be called to determine whether the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;DataReader retrieved any rows from the source. This can be used before using the Read method to check whether any data has been retrieved. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Example&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Dim objCmd as New SqlCommand("Select * from t_Employees", objCon)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;objCon.Open()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Dim objReader as SqlDataReader&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;objReader = objCom.ExecuteReader(CommandBehavior.CloseConnection)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;If objReader.HasRows = True then&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Do While objReader.Read()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;ListBox1.Items.Add(objReader.GetString(0) &amp;amp; vbTab &amp;amp; objReader.GetInt16(1))&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Loop&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;End If&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;objReader.Close()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;(NOTE: XmlReader object is used for Forward only Read only access of XML). &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A DataSet represents an in-memory cache of data consisting of any number of inter-related &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;DataTable objects. A DataTable object represents a tabular block of in-memory data. Further, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;a DataRow represents a single row of a DataTable object. A Dataset is like a mini-database &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;engine, but its data is stored in the memory. To query the data in a DataSet, we can use a &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;DataView object. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Example&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Dim objCon as SqlConnection =&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;New SqlConnection("server=(local);database=NameOfYourDb;user id=sa; password=;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Dim da as New SqlDataAdapter&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Dim ds as DataSet = New DataSet&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;da.SelectCommand.Connection = objCon 'The Data Adapter manages on its own, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;opening &amp;amp; closing of connection object&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;da.SelectCommand.CommandText = "Select * from t_SomeTable"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;da.Fill(ds,"YourTableName")&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Suppose you want to bind the data in this dataset to a gridview&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Gridview1.DataSource = ds&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Gridview1.DataMember = "YourTableName"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Gridview1.Databind()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is a property? What is an event? &lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Property - A property is a thing that describes the features of an object. A property is a piece of&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;data contained within a class that has an exposed interface for reading/writing. Looking at this&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;definition, we might think we could declare a public variable in a class and call it a property.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;While this assumption is somewhat valid, the real technical term for a public variable in a class &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;is a field. The main difference between a field and a property is in the inclusion of an interface. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;We make use of Get and Set keywords while working with properties. We prefix the variables&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;used within this code block with an underscore. Value is a keyword, that holds the value which&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;is being retrieved or set.ss="a"&gt; &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Private _Color As String &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;   &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Public Property Color() &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Get &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;      &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Return _Color&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;End Get &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Set(ByVal Value) &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;      &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;_Color = Value &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;    &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;End Set &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;End Property &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Event - An action that an object does. When something happens, we say an event has happened&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;. For example, when a button is clicked, we say it is the click( ) event. When a mouse hovers on&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;an image, we say the mouseover( ) event has taken place. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;What is Serialization? What is serializable attribute used for? &lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Serialization - The process of converting an object into a stream of bytes. This stream of bytes can be persisted. Deserialization is an opposite process,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;which involves converting a stream of bytes into an object. Serialization is used usually during remoting (while transporting objects) and to persist file &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;objecst &amp;amp; database objects. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;.NET provides 2 ways for serializtion 1) XmlSerializer and 2) BinaryFormatter/SoapFormatter &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The XmlSerializer is used for Web Services. The BinaryFormatter &amp;amp; SoapFormatter is used for Remoting. While using XmlSerializer, it is required that the &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;target class has parameter less constructors, has public read-write properties and has fields that can be serialized. The XmlSerializer has good support for&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;XML documents. It can be used to construct objects from existing XML documents. The XmlSerializer enables us to serialize and deserialize objects to&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;an XML format. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;SoapFormatter enables us to serialize &amp;amp; deserialize objects to SOAP format. They can serialize private and public fields of a class. The target class must&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;be marked with the Serializable attribute. On deserialization, the constructor of the new object is not invoked. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The BinaryFormatter has the same features as the SoapFormatter except that it formats data into binary format. The BinaryForamatter (and the&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;SoapFormatter) has two main methods. Serialize and Deserialize. To serialize an object, we pass an instance of the stream and the object to the&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt; &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Serialize method. To Deserialize an object, you pass an instance of a stream to the Deserialize method. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Delegate in C#&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Definition:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Delegate is type which  holds the method(s) reference in an object. It is also reffered as a type safe function pointers.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Advantages:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Encapsulating the method's call from caller. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Effective use of Delegat improves the performance of application. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Used to call a method asynchronously.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Multicast Delegate&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;It is a Delegate which holds the reference of more than one methods.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Multicast delegates must contain only methods that return void, else there is a run-time exception.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Simple Program using Multicast Delegate&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;delegate void Delegate_Multicast(int x, int y);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Class Class2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;static void Method1(int x, int y) {&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("You r in Method 1");&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;static void Method2(int x, int y) {&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Console.WriteLine("You r in Method 2");&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;public static void Main() &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Delegate_Multicast func = new Delegate_Multicast(Method1);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;func += new Delegate_Multicast(Method2);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;func(1,2);             // Method1 and Method2 are called&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;func -= new Delegate_Multicast(Method1);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;  &lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;func(2,3);             // Only Method2 is called&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;}                              &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Explanation:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In the above example you can see that two methods are defined named method1 and method2 whchi takes two integer parameters and return type as void.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;In the main method the Delegate object is created using the following statement&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Delegate_Multicast func = new Delegate_Multicast(Method1);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Then the Delegate is added using the += operator and removed using -= operator.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-990480854764069314?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/990480854764069314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=990480854764069314' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/990480854764069314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/990480854764069314'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/name1.html' title='name1'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-5906874470085895410</id><published>2008-09-24T23:34:00.001-07:00</published><updated>2008-09-24T23:34:50.825-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server Reporting Services'/><title type='text'>SQL Server Reporting Services</title><content type='html'>&lt;h2&gt;Easily Create Reports using the ReportViewer&lt;/h2&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/imgC.jpg" width="225" height="273" /&gt;&lt;/p&gt; &lt;p&gt;You can implement complex reports and graphs that can be exported to Excel or  Adobe PDF using the free Microsoft &lt;strong&gt;ReportViewer&lt;/strong&gt;. For this  example we will create a Survey and enter some data. We will then create a  DotNetNuke module that will use the &lt;strong&gt;ReportViewer&lt;/strong&gt; to display a  simple report and graph.&lt;/p&gt; &lt;h3&gt;Create a Survey&lt;/h3&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img9.jpg" width="392" height="188" /&gt;&lt;/p&gt; &lt;p&gt;Add the Survey module to a page in your DotNetNuke site (&lt;a href="http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/51/threadid/122127/scope/posts/Default.aspx"&gt;see  this page for instructions&lt;/a&gt;).&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/imgE.jpg" width="152" height="341" /&gt;&lt;/p&gt; &lt;p&gt;Enter a few questions.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img10.jpg" width="384" height="58" /&gt;&lt;/p&gt; &lt;p&gt;Configure the Survey to use Registered User Vote Tracking. &lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img13.jpg" width="174" height="99" /&gt;&lt;/p&gt; &lt;p&gt;Then, submit answers with a few different users. You will have to log in as  each user to do this.&lt;/p&gt; &lt;h3&gt;Create the DotNetNuke Module&lt;/h3&gt; &lt;p&gt;First, install the latest version of DotNetNuke from &lt;a href="http://dotnetnuke.com/"&gt;DotNetNuke.com&lt;/a&gt; (&lt;a href="http://www.adefwebserver.com/DotNetNukeHELP/"&gt;see this  page for assistance&lt;/a&gt;). From the menu bar select &lt;strong&gt;File&lt;/strong&gt; then &lt;strong&gt;Open Web Site... &lt;/strong&gt;to open the site in Visual Studio. &lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img37.jpg" width="263" height="86" /&gt;&lt;/p&gt; &lt;p&gt;In the Solution Explorer, right-click on the &lt;strong&gt;App_Code&lt;/strong&gt; folder  and select &lt;strong&gt;New Folder&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img3B.jpg" width="160" height="76" /&gt;&lt;/p&gt; &lt;p&gt;Name the folder "&lt;strong&gt;SurveyReport&lt;/strong&gt;".&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img3E.jpg" width="208" height="42" /&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Right-click &lt;/strong&gt;on &lt;strong&gt;SurveyReport&lt;/strong&gt; and select &lt;strong&gt;Add new Item...&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img42.jpg" width="804" height="527" /&gt;&lt;/p&gt; &lt;p&gt;From the &lt;strong&gt;Add New Item&lt;/strong&gt; menu select &lt;strong&gt;DataSet&lt;/strong&gt;  and name it &lt;strong&gt;SureyData.xsd&lt;/strong&gt;. Click the &lt;strong&gt;Add&lt;/strong&gt;  button.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img30.jpg" width="666" height="320" /&gt;&lt;/p&gt; &lt;p&gt;The &lt;strong&gt;TableAdapter Configuration Wizard&lt;/strong&gt; will appear. Select &lt;strong&gt;SiteSqlServer&lt;/strong&gt; from the drop-down and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img33.jpg" width="668" height="515" /&gt;&lt;/p&gt; &lt;p&gt;Select &lt;strong&gt;Use SQL statements &lt;/strong&gt;on the next screen and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img35.jpg" width="668" height="515" /&gt;&lt;/p&gt; &lt;p&gt;Click the &lt;strong&gt;Query Builder&lt;/strong&gt; button.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img45.jpg" width="483" height="374" /&gt;&lt;/p&gt; &lt;p&gt;When the &lt;strong&gt;Add Table&lt;/strong&gt; box appears, click the &lt;strong&gt;Refresh&lt;/strong&gt;  button and ensure that you see Surveys in the list of tables.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img81.jpg" width="668" height="515" /&gt;&lt;/p&gt; &lt;p&gt;Click &lt;strong&gt;Close&lt;/strong&gt; on the &lt;strong&gt;Add Table &lt;/strong&gt;box and &lt;strong&gt;Cancel&lt;/strong&gt; on the &lt;strong&gt;Query Builder&lt;/strong&gt; box, and enter  the following in the box on the &lt;strong&gt;Enter a SQL Statement&lt;/strong&gt; step and  click &lt;strong&gt;Finish&lt;/strong&gt;.&lt;/p&gt; &lt;p class="style1"&gt;SELECT SurveyOptions.OptionName, SurveyOptions.Votes,  Surveys.Question&lt;br /&gt;FROM SurveyOptions INNER JOIN&lt;br /&gt;Surveys ON SurveyOptions.SurveyID = Surveys.SurveyID&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img83.jpg" width="218" height="144" /&gt;&lt;/p&gt; &lt;p&gt;You have now configured a Table adapter that contains the data for your  report.&lt;/p&gt; &lt;h3&gt;Add the ReportViewer control&lt;/h3&gt; &lt;p&gt; &lt;img alt="" src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight4Beginners/images/img3.jpg" width="246" height="90" /&gt;&lt;/p&gt; &lt;p&gt;In the Solution Explorer, right-click on the &lt;strong&gt;DesktopModules&lt;/strong&gt;  folder and select &lt;strong&gt;New Folder&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img1A.jpg" width="133" height="25" /&gt;&lt;/p&gt; &lt;p&gt;Name the folder "&lt;strong&gt;SurveyReport&lt;/strong&gt;".&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img1C.jpg" width="232" height="46" /&gt;&lt;/p&gt; &lt;p&gt;Next, right-click on the &lt;strong&gt;SurveyReport&lt;/strong&gt; folder and select &lt;strong&gt;Add New Item...&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img1F.jpg" width="804" height="527" /&gt;&lt;/p&gt; &lt;p&gt;Select &lt;strong&gt;Web User Control&lt;/strong&gt;, enter &lt;strong&gt;View.ascx &lt;/strong&gt; for the name, select &lt;strong&gt;Visual Basic&lt;/strong&gt; for the language, ensure that &lt;strong&gt;Place code in a separate file&lt;/strong&gt; is checked, and click the &lt;strong&gt; Add&lt;/strong&gt; button.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img4D.jpg" width="137" height="56" /&gt;&lt;/p&gt; &lt;p&gt;In the Solution Explorer, double-click on the &lt;strong&gt;View.ascx.vb &lt;/strong&gt; file and open it in the code editing window.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img50.jpg" width="456" height="242" /&gt;&lt;/p&gt; &lt;p&gt;Enter the following code and save the page:&lt;/p&gt; &lt;p class="style1"&gt;Imports System&lt;br /&gt;Imports DotNetNuke&lt;br /&gt;Imports DotNetNuke.Common&lt;br /&gt;Imports System.Collections.Generic&lt;br /&gt;Imports System.Web.UI.WebControls&lt;br /&gt;Imports System.Collections&lt;br /&gt;&lt;br /&gt;Partial Class DesktopModules_SurveyReport_View&lt;br /&gt;    Inherits Entities.Modules.PortalModuleBase&lt;br /&gt;&lt;br /&gt;End Class&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img54.jpg" width="153" height="54" /&gt;&lt;/p&gt; &lt;p&gt;In the Solution Explorer, double-click on &lt;strong&gt;View.ascx&lt;/strong&gt; to open  it in the code editing window.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img24.jpg" width="193" height="34" /&gt;&lt;/p&gt; &lt;p&gt;Switch to &lt;strong&gt;Design&lt;/strong&gt; view.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img27.jpg" width="325" height="364" /&gt;&lt;/p&gt; &lt;p&gt;From the &lt;strong&gt;Toolbox&lt;/strong&gt;, under the &lt;strong&gt;Data&lt;/strong&gt; section  select &lt;strong&gt;ReportViewer&lt;/strong&gt; and drag it to the design surface of the &lt;strong&gt;View.ascx&lt;/strong&gt; page.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img2A.jpg" width="661" height="152" /&gt;&lt;/p&gt; &lt;p&gt;Click the &lt;strong&gt;&lt; &lt;/strong&gt;arrow in the upper right-hand corner of the &lt;strong&gt;ReportViewer&lt;/strong&gt; control to display the &lt;strong&gt;Task&lt;/strong&gt; menu.  Click on the &lt;strong&gt;Design a new report&lt;/strong&gt; link.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img8A.jpg" width="472" height="148" /&gt;&lt;/p&gt; &lt;p&gt;The report designer will appear.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img5B.jpg" width="231" height="38" /&gt;&lt;/p&gt; &lt;p&gt;Switch to &lt;strong&gt;Toolbox&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img5E.jpg" width="345" height="234" /&gt;&lt;/p&gt; &lt;p&gt;From the &lt;strong&gt;Toolbox&lt;/strong&gt;, select &lt;strong&gt;Table&lt;/strong&gt; and drag it  to the design surface.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img64.jpg" width="213" height="37" /&gt;&lt;/p&gt; &lt;p&gt;Switch back to &lt;strong&gt;Website Data Sources&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img88.jpg" width="765" height="152" /&gt;&lt;/p&gt; &lt;p&gt;Expand the &lt;strong&gt;SurveyData&lt;/strong&gt; node (if it is not already expanded).&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img86.jpg" width="665" height="136" /&gt;&lt;/p&gt; &lt;p&gt;Drag the &lt;strong&gt;Question&lt;/strong&gt;, &lt;strong&gt;OptionName&lt;/strong&gt;, and &lt;strong&gt; Votes&lt;/strong&gt; fields to a separate columns on the Detail row (the second row) on  the Table. The name of the field will automatically appear in the Header row.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img6D.jpg" width="212" height="60" /&gt;&lt;/p&gt; &lt;p&gt;From the Toolbar menu select &lt;strong&gt;Build&lt;/strong&gt; then &lt;strong&gt;Build Web  Site&lt;/strong&gt;. The site should build without errors.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img7D.jpg" width="669" height="198" /&gt;&lt;/p&gt; &lt;p&gt;Select the &lt;strong&gt;View.ascx&lt;/strong&gt; page, and on the design view, click the &lt;strong&gt;&lt; &lt;/strong&gt;arrow in the upper right-hand corner of the &lt;strong&gt; ReportViewer&lt;/strong&gt; control to expand the &lt;strong&gt;ReportViewer Tasks&lt;/strong&gt;  menu. From that menu, for the &lt;strong&gt;Choose Report&lt;/strong&gt; option, select the &lt;strong&gt;.rdlc&lt;/strong&gt; report that is located in the &lt;strong&gt;DesktopModules\SureyReport&lt;/strong&gt;  folder.&lt;/p&gt; &lt;p&gt;Save the page.&lt;/p&gt; &lt;h3&gt;Create the module definition&lt;/h3&gt; &lt;p&gt;Navigate to the DotNetNuke site using the web browser and log in as the &lt;strong&gt;Host&lt;/strong&gt; account. From the &lt;strong&gt;Host menu&lt;/strong&gt;, select &lt;strong&gt;Module Definitions&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt; &lt;img alt="" src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight4Beginners/images/img2C1.jpg" width="202" height="88" /&gt;&lt;/p&gt; &lt;p&gt;From the Module Definitions menu select &lt;strong&gt;Create Module Definition&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt; &lt;img alt="" src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight4Beginners/images/img2E1.jpg" width="204" height="81" /&gt;&lt;/p&gt; &lt;p&gt;Enter "&lt;strong&gt;SurveyReport&lt;/strong&gt;" for &lt;strong&gt;Module Name&lt;/strong&gt;, &lt;strong&gt;Folder Name&lt;/strong&gt;, and &lt;strong&gt;Friendly Name&lt;/strong&gt;. Then click the &lt;strong&gt;Create&lt;/strong&gt; link.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img71.jpg" width="376" height="284" /&gt;&lt;/p&gt; &lt;p&gt;Next, enter "&lt;strong&gt;SurveyReport&lt;/strong&gt;" for &lt;strong&gt;New Definition&lt;/strong&gt;  and click the &lt;strong&gt;Add Definition&lt;/strong&gt; link.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img74.jpg" width="566" height="41" /&gt;&lt;/p&gt; &lt;p&gt; Click the &lt;strong&gt;Add Control&lt;/strong&gt; link.&lt;/p&gt; &lt;p&gt; &lt;img alt="" src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight4Beginners/images/img37.jpg" width="84" height="31" /&gt;&lt;/p&gt; &lt;p&gt;On the &lt;strong&gt;Edit Module Control&lt;/strong&gt; page enter "&lt;strong&gt;SurveyReport&lt;/strong&gt;"  for &lt;strong&gt;Title&lt;/strong&gt;, select the &lt;strong&gt;DesktopModules/SurveyReport/View.ascx&lt;/strong&gt;  from the &lt;strong&gt;Source&lt;/strong&gt; drop-down, ensure that &lt;strong&gt;Type&lt;/strong&gt; is  set to &lt;strong&gt;View&lt;/strong&gt; and click the &lt;strong&gt;Update&lt;/strong&gt; link.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img77.jpg" width="502" height="415" /&gt;&lt;/p&gt; &lt;p&gt;Navigate to a page in the DotNetNuke site, and from the administration menu,  select &lt;strong&gt;SurveyReport&lt;/strong&gt; from the Module drop-down and click the &lt;strong&gt;Add&lt;/strong&gt; link.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img7A.jpg" width="403" height="123" /&gt;&lt;/p&gt; &lt;p&gt;The module will now appear.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img8D.jpg" width="428" height="356" /&gt;&lt;/p&gt; &lt;h3&gt;Add a Chart&lt;/h3&gt; &lt;p&gt;Return to Visual Studio navigate to the report designer. &lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img93.jpg" width="483" height="356" /&gt;&lt;/p&gt; &lt;p&gt;Switch to the &lt;strong&gt;Toolbox&lt;/strong&gt; and select and drag a &lt;strong&gt;Chart&lt;/strong&gt;  control to the design surface.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img97.jpg" width="739" height="515" /&gt;&lt;/p&gt; &lt;p&gt;Switch to &lt;strong&gt;Website Data Sources&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img2.jpg" width="414" height="380" /&gt;&lt;/p&gt; &lt;p&gt;Carefully drag each field first on top of the colored part of the chart  graphic then into each chart section so the layout resembles the graphic above. &lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img5.jpg" width="410" height="378" /&gt;&lt;/p&gt; &lt;p&gt;Right-click on the report and select properties&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img8.jpg" width="723" height="669" /&gt;&lt;/p&gt; &lt;p&gt;On the &lt;strong&gt;Legend&lt;/strong&gt; tab select &lt;strong&gt;Table&lt;/strong&gt; for &lt;strong&gt; Layout&lt;/strong&gt; and the lower middle square for &lt;strong&gt;Position&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/imgA.jpg" width="723" height="669" /&gt;&lt;/p&gt; &lt;p&gt;On the &lt;strong&gt;3D Effect&lt;/strong&gt; tab, click the &lt;strong&gt;Display chart with  3-D visual effect&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;Click the &lt;strong&gt;OK&lt;/strong&gt; button.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img9D.jpg" width="317" height="336" /&gt;&lt;/p&gt; &lt;p&gt;Switch to the &lt;strong&gt;View.ascx&lt;/strong&gt; page and click once on the &lt;strong&gt; ReportViewer&lt;/strong&gt; control. In the control properties set the &lt;strong&gt;Height&lt;/strong&gt;  and &lt;strong&gt;Width&lt;/strong&gt; to &lt;strong&gt;800px&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;Hold down the &lt;strong&gt;Ctrl&lt;/strong&gt; key and the &lt;strong&gt;Shift&lt;/strong&gt; key and click the  &lt;strong&gt;S&lt;/strong&gt; key (Ctrl+Shift+S) to  save all pages. Refresh the page in the web browser. The finished report should  now appear.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img11.jpg" width="667" height="654" /&gt;&lt;/p&gt; &lt;h3&gt;Add Parameters&lt;/h3&gt; &lt;p&gt;Switch back to Visual Studio. &lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img3.jpg" width="247" height="129" /&gt;&lt;/p&gt; &lt;p&gt;In the design view of &lt;strong&gt;View.ascx&lt;/strong&gt;, place a &lt;strong&gt; DropDownList&lt;/strong&gt; above the report control. From it's &lt;strong&gt;Tasks&lt;/strong&gt;  menu, select &lt;strong&gt;Edit Items&lt;/strong&gt;.&lt;/p&gt; &lt;h3&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img6.jpg" width="589" height="421" /&gt;&lt;/h3&gt; &lt;p&gt;In the &lt;strong&gt;ListItem Collection Editor&lt;/strong&gt;, enter values you would  like to search on. and click the &lt;strong&gt;OK&lt;/strong&gt; button.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img12.jpg" width="150" height="96" /&gt;&lt;/p&gt; &lt;p&gt;On it's &lt;strong&gt;Tasks&lt;/strong&gt; menu of the &lt;strong&gt;DropDownList&lt;/strong&gt;,  select &lt;strong&gt;Enable AutoPostBack&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/imgB.jpg" width="287" height="150" /&gt;&lt;/p&gt; &lt;p&gt;Right-click on the &lt;strong&gt;SureyData.xsd &lt;/strong&gt;file (in the Solution  Explorer) and select &lt;strong&gt;View Designer&lt;/strong&gt; to bring up the &lt;strong&gt;Data  Adapter&lt;/strong&gt; designer, Right-click on the header of the &lt;strong&gt;DataTable&lt;/strong&gt;  and select &lt;strong&gt;Configure...&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/imgE1.jpg" width="668" height="515" /&gt;&lt;/p&gt; &lt;p&gt;Click the &lt;strong&gt;Query Builder&lt;/strong&gt; button.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/imgF.jpg" width="707" height="574" /&gt;&lt;/p&gt; &lt;p&gt;In the &lt;strong&gt;Filter&lt;/strong&gt; column for the &lt;strong&gt;Question&lt;/strong&gt; row,  enter "&lt;strong&gt;@Question&lt;/strong&gt;" and click the &lt;strong&gt;OK&lt;/strong&gt; button.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img14.jpg" width="668" height="515" /&gt;&lt;/p&gt; &lt;p&gt;Click &lt;strong&gt;Finish&lt;/strong&gt;. &lt;/p&gt; &lt;p&gt;&lt;span class="style3"&gt;Save the Page.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img15.jpg" width="582" height="126" /&gt;&lt;/p&gt; &lt;p&gt;In the design view on the &lt;strong&gt;View.ascx&lt;/strong&gt; page, click on the &lt;strong&gt;Tasks&lt;/strong&gt; menu for the &lt;strong&gt;ObjectDataSource&lt;/strong&gt; control  (located at the bottom of the page) and click &lt;strong&gt;Refresh Schema&lt;/strong&gt;,  then click &lt;strong&gt;Configure Data Source....&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img18.jpg" width="748" height="550" /&gt;&lt;/p&gt; &lt;p&gt;Click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img17.jpg" width="748" height="550" /&gt;&lt;/p&gt; &lt;p&gt;Select the &lt;strong&gt;GetData&lt;/strong&gt; method that takes (String Question) in  the dropdown and click &lt;strong&gt;Next&lt;/strong&gt;. (If you don't see it click &lt;strong&gt; Cancel&lt;/strong&gt;, save all files and try again. If you still don't see it close  and re-open Visual Studio.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img1B.jpg" width="748" height="550" /&gt;&lt;/p&gt; &lt;p&gt;Select &lt;strong&gt;Control&lt;/strong&gt; for &lt;strong&gt;Parameter source&lt;/strong&gt; and the &lt;strong&gt;DropDown&lt;/strong&gt; control for the &lt;strong&gt;ControlID&lt;/strong&gt;. Click &lt;strong&gt;Finish&lt;/strong&gt;. Save all pages.&lt;/p&gt; &lt;p&gt; &lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img1D.jpg" width="715" height="512" /&gt;&lt;/p&gt; &lt;p&gt;Refresh the page in the web browser. The finished report should  now appear.&lt;/p&gt; &lt;p&gt;When you select an option from the drop-down and click the Refresh (&lt;img src="http://www.adefwebserver.com/DotNetNukeHELP/Misc/DNNReports/images/img1F1.jpg" width="21" height="23" /&gt;)  icon the report will now filter.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-5906874470085895410?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/5906874470085895410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=5906874470085895410' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/5906874470085895410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/5906874470085895410'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/sql-server-reporting-services.html' title='SQL Server Reporting Services'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-2614939263446629220</id><published>2008-09-24T00:03:00.000-07:00</published><updated>2008-09-24T00:04:15.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server Interview Questions'/><title type='text'>SQL Server Interview Questions</title><content type='html'>&lt;span id="intelliTXT"&gt;&lt;h2&gt;Introduction&lt;/h2&gt;  &lt;p&gt;In this article we will go through the most basic and frequently asked interview questions on SQL Server. Please do not think that I am writing this article to show shortcuts to candidates who are searching for jobs on SQL Server. But I think no matter how much experience you have, an interview is a different ball game. A good project executioner can get knocked off on simple SQL Server questions. This article will be a complete series, so here's my first from the series - SQL Server Interview Questions Part 1. &lt;/p&gt;  &lt;p&gt;Feel free to write to me at &lt;a href="mailto:shiv_koirala@yahoo.com"&gt;shiv_koirala@yahoo.com&lt;/a&gt; or else you can also visit &lt;a href="http://www.questpond.com/"&gt;my website&lt;/a&gt; for more such interview questions. &lt;/p&gt;  &lt;p&gt;Happy job hunting....&lt;/p&gt;  &lt;h2&gt;Interview Questions on Database Concepts&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#%28DBMS%29tc_What_is_database_or_database_management_systems_%28DBMS%29"&gt;(Q) What is a database or database management system (DBMS)?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisdifferencebetweenDBMSandRDBMStcWhatsdifferencebetweenDBMSandRDBM"&gt;(Q) What is the difference between DBMS and RDBMS?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#DBWhatareCODDrulestc_DBWhatareCODDrules"&gt;(DB) What are COD rules?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#IsaccessdatabaseaRDBMStcIsaccessdatabaseaRDBMS"&gt;(Q) Is Access database a RDBMS?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisthemaindifferencebetweenACCESSandSQLSERVERtcWhatsthemaindifferencebetweenACCESSandSQLSERVER"&gt;(Q) What is the main difference between ACCESS and SQL SERVER?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisthedifferencebetweenMSDEandSQLSERVER2000tcWhatsthedifferencebetweenMSDEandSQLSERVER2000"&gt;(Q) What is the difference between MSDE and SQL SERVER 2000?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisSQLSERVERExpress2005EditiontcWhatisSQLSERVERExpress2005Edition"&gt;(Q) What is SQL SERVER Express 2005 Edition?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#DBWhatisSQLServer2000WorkloadGovernortcDBWhatisSQLServer2000WorkloadGovernor"&gt;(DB) What is SQL Server 2000 Workload Governor?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisthedifferencebetweenSQLSERVER2000and2005tcWhatsthedifferencebetweenSQLSERVER2000and2005"&gt;(Q) What is the difference between SQL SERVER 2000 and 2005?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatareERdiagramstcWhatareERdiagrams"&gt;(Q) What are E-R diagrams?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#%28Q%29_How_many_types_of_relationship_exist_in_database_designingtc_How_many_types_of_Howmanytypes%20ofrelationshipexistindatabasedesigningtc%20Howmanytypesofrelationshipexistindatabasedesigningrelationshipexistindatabasedesigning"&gt;(Q) How many types of relationships exist in database designing?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisnormalizationWhataredifferenttypeofnormalizationtcWhatisnormalizationWhataredifferenttypeofnormalization"&gt;(Q) What is normalization? What are the different type of normalization?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisdenormalizationtcWhatisdenormalization"&gt;(Q) What is denormalization?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#DBCanyouexplainFourthNormalFormtcDBCanyouexplainFourthNormalForm"&gt;(DB) Can you explain Fourth Normal Form?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#CanyouexplainFifthNormalFormDBCanyouexplainFifthNormalForm"&gt;(DB) Can you explain Fifth Normal Form? &lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisthedifferencebetweenFourthandFifthnormalformtcDBWhatsthedifferencebetweenFourthandFifthnormalform"&gt;(DB) What is the difference between Fourth and Fifth normal form?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#HaveyouheardaboutsixthnormalformtcDBHaveyouheardaboutsixthnormalform"&gt;(DB) Have you heard about sixth normal form?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatisExtentandPagetcWhatisExtentandPage"&gt;(Q) What is Extent and Page?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#DBWhatarethedifferentsectionsinPagetcDBWhatarethedifferentsectionsinPage"&gt;(DB) What are the different sections in Page?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#WhatarepagesplitstcWhatarepagesplits"&gt;(Q) What are page splits?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#InwhichfilesdoesactuallySQLServerstoredatatcInwhichfilesdoesactuallySQLServerstoredata"&gt;(Q) In which files does SQL Server actually store data?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/KB/database/SQLInterviewQuestions.aspx#DBCanwehaveadifferentcollationfordatabaseandtabletcDBCanwehaveadifferentcollationfordatabaseandtable"&gt;(DB) Can we have a different collation for database and table?&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Chapter 1: Database Concepts&lt;/h2&gt;  &lt;h3&gt;&lt;a name="(DBMS)tc_What_is_database_or_database_management_systems_(DBMS)"&gt;(Q) What is a Database or Database Management System (DBMS)? &lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Twist: What is the difference between a file and a database? Can files qualify as a database?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Probably these questions are too basic for experienced SQL SERVER guys. But from a fresher’s point of view, it can be a difference between getting a job and being jobless. &lt;/p&gt;  &lt;ol&gt;&lt;li&gt;Database provides a systematic and organized way of storing, managing and retrieving from a collection of logically related information. &lt;/li&gt;&lt;li&gt;Secondly, the information has to be persistent, that means even after the application is closed the information should be persisted. &lt;/li&gt;&lt;li&gt;Finally, it should provide an independent way of accessing data and should not be dependent on the application to access the information. &lt;/li&gt;&lt;/ol&gt;  &lt;p&gt;Ok, let me spend a few more sentences on explaining the third aspect. Below is a simple figure of a text file that has personal detail information. The first column of the information is &lt;code&gt;Name&lt;/code&gt;, second &lt;code&gt;Address &lt;/code&gt;and finally &lt;code&gt;Phone Number&lt;/code&gt;. This is a simple text file, which was designed by a programmer for a specific application. &lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image001.png" width="410" border="0" height="261" hspace="0" /&gt;  &lt;div class="Caption"&gt;Figure 1.1: Non-Uniform Text File&lt;/div&gt;  &lt;p&gt;It works fine in the boundary of the application. Now, some years down the line a third party application has to be integrated with this file. In order for the third party application to be integrated properly, it has the following options:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Use the interface of the original application.&lt;/li&gt;&lt;li&gt;Understand the complete details of how the text file is organized, example the first column is &lt;code&gt;Name&lt;/code&gt;, then &lt;code&gt;Address &lt;/code&gt;and finally &lt;code&gt;Phone Number&lt;/code&gt;. After analyzing, write a code which can read the file, parse it etc. Hmm, lot of work, right.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;That’s what the main difference is between a simple file and a database; database has an independent way (SQL) of accessing information while simple files do not (That answers my twisted question defined above). File meets the storing, managing and retrieving part of a database, but not the independent way of accessing data.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Many experienced programmers think that the main difference is that file cannot provide multi-user capabilities which a DBMS provides. But if you look at some old COBOL and C programs where files were the only means of storing data, you can see functionalities like locking, multi-user etc. provided very efficiently. So it’s a matter of debate. If some interviewers think of this as a main difference between files and database, accept it… going in to debate means probably losing a job.&lt;/p&gt;  &lt;p&gt;(Just a note for fresher’s: Multi-user capabilities mean that at one moment of time more than one user should be able to add, update, view and delete data. All DBMS' provides this as in-built functionalities, but if you are storing information in files, it’s up to the application to write logic to achieve these functionalities).&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatisdifferencebetweenDBMSandRDBMStcWhatsdifferencebetweenDBMSandRDBM"&gt;(Q) What is the Difference between DBMS and RDBMS?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;As mentioned before, DBMS provides a systematic and organized way of storing, managing and retrieving from a collection of logically related information. RDBMS also provides what DBMS provides, but above that, it provides relationship integrity. So in short, we can say:&lt;/p&gt;  &lt;blockquote dir="ltr" style="margin-right: 0px;"&gt; &lt;p&gt;RDBMS = DBMS + REFERENTIAL INTEGRITY&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;For example, in the above Figure 1.1, every person should have an &lt;code&gt;Address&lt;/code&gt;. This is a referential integrity between &lt;code&gt;Name&lt;/code&gt; and &lt;code&gt;Address&lt;/code&gt;. If we break this referential integrity in DBMS and files, it will not complain, but RDBMS will not allow you to save this data if you have defined the relation integrity between person and addresses. These relations are defined by using “Foreign Keys” in any RDBMS.&lt;/p&gt;  &lt;p&gt;Many DBMS companies claimed that their DBMS product was RDBMS compliant, but according to industry rules and regulations, if the DBMS fulfills the twelve CODD rules, it’s truly a RDBMS. Almost all DBMS (SQL SERVER, ORACLE etc.) fulfill all the twelve CODD rules and are considered truly as RDBMS.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;One of the biggest debates is whether Microsoft Access is an RDBMS? We will be answering this question in later section. &lt;/p&gt;  &lt;h3&gt;&lt;a name="DBWhatareCODDrulestc_DBWhatareCODDrules"&gt;(DB)What are CODD Rules? &lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Twist: Does SQL SERVER support all the twelve CODD rules?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;This question can only be asked on two conditions when the interviewer is expecting you to be at a DBA job or you are complete fresher, yes and not to mention the last one he treats CODD rules as a religion. We will try to answer this question from the perspective of SQL SERVER. &lt;/p&gt;  &lt;p&gt;In 1969, Dr. E. F. Codd laid down 12 rules, which a DBMS should adhere to in order to get the logo of a true RDBMS.&lt;/p&gt;  &lt;h4&gt;Rule 1: Information Rule&lt;/h4&gt;  &lt;p&gt;"All information in a relational database is represented explicitly at the logical level and in exactly one way - by values in tables."&lt;/p&gt;  &lt;p&gt;In SQL SERVER, all data exists in tables and are accessed only by querying the tables. &lt;/p&gt;  &lt;h4&gt;Rule 2: Guaranteed Access Rule&lt;/h4&gt;  &lt;p&gt;"Each and every datum (atomic value) in a relational database is guaranteed to be logically accessible by resorting to a combination of table name, primary key value and column name."&lt;/p&gt;  &lt;p&gt;In flat files, we have to parse and know the exact location of field values. But if a DBMS is truly an RDBMS, you can access the value by specifying the table name, field name, for instance &lt;code&gt;Customers.Fields [‘Customer Name’]&lt;/code&gt;.&lt;/p&gt;  &lt;p&gt;SQL SERVER also satisfies this rule. In ADO.NET we can access field information using table name and field names.&lt;/p&gt;  &lt;h4&gt;Rule 3: Systematic Treatment of Null Values&lt;/h4&gt;  &lt;p&gt;"Null values (distinct from the empty character string or a string of blank characters and distinct from zero or any other number) are supported in fully relational DBMS for representing missing information and inapplicable information in a systematic way, independent of data type.” &lt;/p&gt;  &lt;p&gt;In SQL SERVER, if there is no data existing, &lt;code&gt;NULL&lt;/code&gt; values are assigned to it. Note &lt;code&gt;NULL&lt;/code&gt; values in SQL SERVER do not represent spaces, blanks or a zero value; it is a distinct representation of missing information and thus satisfies rule 3 of CODD.&lt;/p&gt;  &lt;h4&gt;Rule 4: Dynamic On-line Catalog Based on the Relational Model&lt;/h4&gt;  &lt;p&gt;"The database description is represented at the logical level in the same way as ordinary data, so that authorized users can apply the same relational language to its interrogation as they apply to the regular data."&lt;/p&gt;  &lt;p&gt;The Data Dictionary is held within the RDBMS. Thus, there is no need for off-line volumes to tell you the structure of the database.&lt;/p&gt;  &lt;h4&gt;Rule 5: Comprehensive Data Sub-language Rule&lt;/h4&gt;  &lt;p&gt;"A relational system may support several languages and various modes of terminal use (for example, the fill-in-the-blanks mode). However, there must be at least one language whose statements are expressible, per some well-defined syntax, as character strings and that is comprehensive in supporting all the following items: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Data Definition &lt;/li&gt;&lt;li&gt;View Definition &lt;/li&gt;&lt;li&gt;Data Manipulation (Interactive and by program)&lt;/li&gt;&lt;li&gt;Integrity Constraints &lt;/li&gt;&lt;li&gt;Authorization&lt;/li&gt;&lt;li&gt;Transaction boundaries ( Begin, commit and rollback)"&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;SQL SERVER uses SQL to query and manipulate data, which has a well-defined syntax and is being accepted as an international standard for RDBMS.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;According to this rule, CODD has only mentioned that some language should be present to support it, but not necessary that it should be SQL. Before the 80’s, different’s database vendors were providing their own flavor of syntax until in 1980, ANSI-SQL came in to standardize this variation between vendors. As ANSI-SQL is quite limited, every vendor including Microsoft introduced their additional SQL syntax in addition to the support of ANSI-SQL. You can see SQL syntax varying from vendor to vendor.&lt;/p&gt;  &lt;h4&gt;Rule 6: View-updating Rule&lt;/h4&gt;  &lt;p&gt;"All views that are theoretically updatable are also updatable by the system."&lt;/p&gt;  &lt;p&gt;In SQL SERVER, not only views can be updated by the user, but also by SQL SERVER itself.&lt;/p&gt;  &lt;h4&gt;Rule 7: High-level Insert, Update and Delete&lt;/h4&gt;  &lt;p&gt;"The capability of handling a base relation or a derived relation as a single operand applies not only to the retrieval of data, but also to the insertion, update and deletion of data."&lt;/p&gt;  &lt;p&gt;SQL SERVER allows you to update views that in turn affect the base tables.&lt;/p&gt;  &lt;h4&gt;Rule 8: Physical Data Independence&lt;/h4&gt;  &lt;p&gt;"Application programs and terminal activities remain logically unimpaired whenever any changes are made in either storage representations or access methods."&lt;/p&gt;  &lt;p&gt;Any application program (C#, VB.NET, VB6, VC++ etc) does not need to be aware of where the SQL SERVER is physically stored or what type of protocol it is using, the database connection string encapsulates everything.&lt;/p&gt;  &lt;h4&gt;Rule 9: Logical Data Independence&lt;/h4&gt;  &lt;p&gt;"Application programs and terminal activities remain logically unimpaired when information-preserving changes of any kind that theoretically permit un-impairment are made to the base tables."&lt;/p&gt;  &lt;p&gt;Application programs written in C# or VB.NET do not need to know about any structure changes in SQL SERVER database. Example: adding of new field etc.&lt;/p&gt;  &lt;h4&gt;Rule 10: Integrity Independence&lt;/h4&gt;  &lt;p&gt;"Integrity constraints specific to a particular relational database must be definable in the relational data sub-language and storable in the catalog, not in the application programs."&lt;/p&gt;  &lt;p&gt;In SQL SERVER, you can specify data types (&lt;code&gt;integer&lt;/code&gt;, &lt;code&gt;nvarchar&lt;/code&gt;, &lt;code&gt;&lt;span class="code-SDKkeyword"&gt;Boolean&lt;/span&gt; &lt;/code&gt;etc.) which put in data type checks in SQL SERVER rather than through application programs.&lt;/p&gt;  &lt;h4&gt;Rule 11: Distribution Independence&lt;/h4&gt;  &lt;p&gt;"A relational DBMS has distribution independence."&lt;/p&gt;  &lt;p&gt;SQL SERVER can spread across more than one physical computer and across several networks; but from application programs, it has not a big difference but just specifying the SQL SERVER name and the computer on which it is located.&lt;/p&gt;  &lt;h4&gt;Rule 12: Non-subversion Rule&lt;/h4&gt;  &lt;p&gt;"If a relational system has a low-level (single-record-at-a-time) language, that low level cannot be used to subvert or bypass the integrity Rules and constraints expressed in the higher level relational language (multiple-records-at-a-time)."&lt;/p&gt;  &lt;p&gt;In SQL SERVER whatever integrity rules are applied on every record are also applicable when you process a group of records using application program in any other language (example: C#, VB.NET, J# etc.).&lt;/p&gt;  &lt;p&gt;Readers can see from the above explanation that SQL SERVER satisfies all the CODD rules, some database gurus consider SQL SERVER as not truly being an RDBMS, but that’s a matter of debate.&lt;/p&gt;  &lt;h3&gt;&lt;a name="IsaccessdatabaseaRDBMStcIsaccessdatabaseaRDBMS"&gt;(Q) Is Access Database a RDBMS?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Access fulfills all rules of CODD, so from this point of view, yes it’s truly an RDBMS. However, many people can contradict it as a large community of Microsoft professionals think that Access is not an RDBMS.&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatisthemaindifferencebetweenACCESSandSQLSERVERtcWhatsthemaindifferencebetweenACCESSandSQLSERVER"&gt;(Q) What is the Main Difference between ACCESS and SQL SERVER?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;As mentioned before, Access fulfills all the CODD rules and behaves as a true RDBMS. But there’s a huge difference from an architecture perspective, due to which many developers prefer to use SQL SERVER as the major database rather than Access. Following is the list of architecture differences between them:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Access uses file server design and SQL SERVER uses the Client / Server model. This forms the major difference between SQL SERVER and ACCESS.&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt; Just to clarify what is client server and file server I will make a quick description of widely accepted architectures. There are three types of architectures:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Main frame architecture (This is not related to the above explanation but just mentioned as it can be useful during an interview and also for comparing with other architectures)&lt;/li&gt;&lt;li&gt;File sharing architecture (Followed by ACCESS)&lt;/li&gt;&lt;li&gt;Client Server architecture (Followed by SQL SERVER).&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;  &lt;p&gt;In Main Frame architecture, all the processing happens on central host server. User interacts through a dumb terminal that only sends keystrokes and information to the host. All the main processing happens on the central host server. So the advantage in such type of architecture is that you need least configuration clients. But the disadvantage is that you need a robust central host server like Main Frames.&lt;/p&gt;  &lt;p&gt;In File sharing architecture, which is followed by Access database, all the data is sent to the client terminal and then processed. For instance, if you want to see customers who stay in India, in File Sharing architecture all customer records will be sent to the client PC regardless whether the customer belongs to India or not. On the client PC customer records from India are sorted/filtered out and displayed, in short all processing logic happens on the client PC. Therefore, in this architecture, the client PC should have heavy configuration and it increases network traffic as a lot of data is sent to the client PC. However, the advantage of this architecture is that your server can be of a low configuration.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image003.png" width="637" border="0" height="409" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.2: File Server Architecture of Access&lt;/div&gt;  &lt;p&gt;In client server architecture, the above limitation of the file server architecture is removed. In client server architecture, you have two entities, client and the database server. File server is now replaced by database server. Database server takes up the load of processing any database related activity and the client does any validation aspect of database. As the work is distributed between the entities it increases scalability and reliability. Second, the network traffic also comes down as compared to file server. For example if you are requesting customers from India, database server will sort/ filter and send only Indian customer details to the client, thus bringing down the network traffic tremendously. SQL SERVER follows the client-server architecture.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image005.png" width="639" border="0" height="317" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.3: Client Server Architecture of SQL SERVER&lt;/div&gt;  &lt;ul&gt;&lt;li&gt;The second issue comes in terms of reliability. In Access, the client directly interacts with the Access file, in case there is some problem in the middle of a transaction, there are chances that an Access file can get corrupt. But in SQL SERVER, the engine sits in between the client and the database, so in case of any problems in the middle of a transaction, it can revert back to its original state.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;SQL SERVER maintains a transaction log by which you can revert back to your original state in case of any crash.&lt;/li&gt;&lt;li&gt;When your application has to cater to a huge load demand, highly transactional environment and high concurrency, then its better to go for SQL SERVER or MSDE.&lt;/li&gt;&lt;li&gt;But when it comes to cost and support, Access stands better than SQL SERVER. In case of SQL SERVER, you have to pay for per client license, but Access runtime is free.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Summarizing: &lt;/strong&gt;SQL SERVER gains points in terms of network traffic, reliability and scalability whereas Access gains points in terms of cost factor.&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatisthedifferencebetweenMSDEandSQLSERVER2000tcWhatsthedifferencebetweenMSDEandSQLSERVER2000"&gt;(Q) What is the Difference between MSDE and SQL SERVER 2000?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;MSDE is a royalty free, redistributable and cut short version of the giant SQL SERVER database. It is primarily provided as a low cost option for developers who need a database server, which can easily be shipped and installed. It can serve as a good alternative for Microsoft Access database as it overcomes quite a few problems which Access has. &lt;/p&gt;  &lt;p&gt;Below is a complete list, which can give you a good idea of the differences:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;strong&gt;Size of database: &lt;/strong&gt;Microsoft Access and MSDE have a limitation of 2GB while SQL SERVER has 1,048,516 TB1.&lt;/li&gt;&lt;li&gt;Performance degrades in MSDE 2000 when maximum number of concurrent operations goes above 8 or is equal to 8. It does not mean that you cannot have more than eight concurrent operations but the performance degrades. Eight-connection performance degradation is implemented by using SQL SERVER 2000 workload governor (we will be looking into more detail of how it works). As compared to SQL SERVER 2000, you can have 32,767 concurrent connections.&lt;/li&gt;&lt;li&gt;MSDE does not provide OLAP and Data warehousing capabilities.&lt;/li&gt;&lt;li&gt;MSDE does not have support facility for SQL mail.&lt;/li&gt;&lt;li&gt;MSDE 2000 does not have GUI administrative tool such as enterprise manager, Query analyzer or Profiler. But there are roundabout ways by which you can manage MSDE 2000:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Old command line utility &lt;em&gt;OSQL.EXE&lt;/em&gt;&lt;/li&gt;&lt;li&gt;VS.NET IDE Server Explorer: Inside VS.NET IDE, you have a functionality which can give you a nice GUI administrative tool to manage IDE.&lt;/li&gt;&lt;li&gt;SQL SERVER WEB Data administrator installs a web based GUI which you can use to manage your database.&lt;br /&gt;For any details refer &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=c039a798-c57a-%20419e-acbc-2a332cb7f959&amp;amp;displaylang=en"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;SQL-DMO objects can be used to build your custom UI&lt;/li&gt;&lt;li&gt;There are many third party tools, which provide administrative capability GUI, which is out of scope of the book as it is only meant for interview questions. &lt;/li&gt;&lt;li&gt;MSDE does not support Full text search.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Summarizing: &lt;/strong&gt;There are two major differences: The first is the size limitation (2 GB) of the database and second is the concurrent connections (eight concurrent connections) which are limited by using the workload governor. During an interview, this answer will suffice if the interviewer is really testing your knowledge.&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatisSQLSERVERExpress2005EditiontcWhatisSQLSERVERExpress2005Edition"&gt;(Q) What is SQL SERVER Express 2005 Edition?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Twist: What is the difference between SQL SERVER Express 2005 and MSDE 2000?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Normally comparison is when the product is migrating from one version to other version. When SQL SERVER 7.0 was migrating to SQL 2000, asking differences was one of the favorite questions. &lt;/p&gt;  &lt;p&gt;SQL SERVER Express edition is a scaled down version of SQL SERVER 2005 and the next evolution of MSDE. &lt;/p&gt;  &lt;p&gt;Listed below are some major differences between them:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;MSDE maximum database size is 2GB while SQL SERVER Express has around 4GB.&lt;/li&gt;&lt;li&gt;In terms of programming language support MSDE has only TSQL, but SQLSERVER Express has TSQL and .NET. In SQL SERVER Express 2005, you can write your stored procedures using .NET.&lt;/li&gt;&lt;li&gt;SQL SERVER Express does not have connection limitation, which MSDE had and was controlled through the workload governor.&lt;/li&gt;&lt;li&gt;There was no XCOPY support for MSDE, SQL SERVER Express has it.&lt;/li&gt;&lt;li&gt;DTS is not present in SQL SERVER express while MSDE has it.&lt;/li&gt;&lt;li&gt;SQL SERVER Express has reporting services while MSDE does not.&lt;/li&gt;&lt;li&gt;SQL SERVER Express has native XML support and MSDE does not.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;Note: Native XML support means now in SQL SERVER 2005:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;You can create a field with data type &lt;code&gt;XML&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;You can provide SCHEMA to the SQL SERVER fields with &lt;code&gt;XML&lt;/code&gt; data type.&lt;/li&gt;&lt;li&gt;You can use new XML manipulation techniques like &lt;code&gt;XQUERY&lt;/code&gt; also called as &lt;code&gt;XML QUERY&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;There is a complete chapter on SQL SERVER XML Support, so till then this will suffice.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Summarizing:&lt;/strong&gt; The major difference is the database size (2 GB and 4 GB), support of .NET support in stored procedures and native support for XML. This much can convince the interviewer that you are clear about the differences.&lt;/p&gt;  &lt;h3&gt;&lt;a name="DBWhatisSQLServer2000WorkloadGovernortcDBWhatisSQLServer2000WorkloadGovernor"&gt;(DB) What is SQL Server 2000 Workload Governor?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Workload governor limits the performance of SQL SERVER Desktop engine (MSDE) if the SQL engine receives more load than what is meant for MSDE. MSDE was always meant for trial purpose and non-critical projects. Microsoft always wanted companies to buy their full blow version of SQL SERVER, so in order that they can put limitation on MSDE performance and number of connections, they introduced Workload governor.&lt;/p&gt;  &lt;p&gt;Workload governor sits between the client and the database engine and counts the number of connections per database instance. If Workload governor finds that the number of connections exceeds eight connections, it starts stalling the connections and slowing down the database engine. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It does not limit the number of connections but makes the connection request go slow. By default 32,767 connections are allowed both for SQL SERVER and MSDE. But it just makes the database engine go slow above eight connections.&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatisthedifferencebetweenSQLSERVER2000and2005tcWhatsthedifferencebetweenSQLSERVER2000and2005"&gt;What is the Difference between SQL SERVER 2000 and 2005?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Twist: What is the difference between Yukon and SQL SERVER 2000? &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;This question will be one of the favorites during SQL SERVER interviews. I have marked the points which should be mentioned by developers as PG and DBA for Database Administrator.&lt;/p&gt;  &lt;p&gt;Following are some major differences between the two versions:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;(PG) The most significant change is the .NET integration with SQL SERVER 2005. Stored procedures, user-defined functions, triggers, aggregates, and user-defined types can now be written using your own favorite .NET language (VB.NET, C#, J# etc.). This support was not there in SQL SERVER 2000 where the only language was T-SQL. In SQL 2005, you have support for two languages T-SQL and .NET.&lt;/li&gt;&lt;li&gt;(PG) SQL SERVER 2005 has reporting services for reports which is a newly added feature and does not exist for SQL SERVER 2000. It was a separate installation for SQL Server 2000.&lt;/li&gt;&lt;li&gt;(PG) SQL SERVER 2005 has introduced two new data types &lt;code&gt;varbinary (max)&lt;/code&gt; and &lt;code&gt;XML&lt;/code&gt;. If you remember in SQL SERVER 2000, we had image and text data types. Problem with &lt;code&gt;image &lt;/code&gt;and &lt;code&gt;text &lt;/code&gt;data types is that they assign the same amount of storage irrespective of what the actual data size is. This problem is solved using &lt;code&gt;varbinary (max) &lt;/code&gt;which acts depending on amount of data. One more new data type is included &lt;code&gt;XML&lt;/code&gt; which enables you to store XML documents and does schema verification. In SQL SERVER 2000, developers used &lt;code&gt;varchar &lt;/code&gt;or &lt;code&gt;text &lt;/code&gt;data type and all validation had to be done programmatically.&lt;/li&gt;&lt;li&gt;(PG) SQL SERVER 2005 can now process direct incoming HTTP request without IIS Web server. In addition, stored procedure invocation is enabled using the SOAP protocol.&lt;/li&gt;&lt;li&gt;(PG) Asynchronous mechanism is introduced using server events. In Server event model the server posts an event to the SQL Broker service, later the client can come and retrieve the status by querying the broker.&lt;/li&gt;&lt;li&gt;For huge databases, SQLSERVER has provided a cool feature called “Data partitioning”. In data partitioning, you break a single database object such as a table or an index into multiple pieces. But for the client application accessing the single database object, “partitioning” is transparent.&lt;/li&gt;&lt;li&gt;In SQL SERVER 2000, if you rebuilt clustered indexes even the non-clustered indexes where rebuilt. But in SQL SERVER 2005 building the clustered indexes does not build the non-clustered indexes.&lt;/li&gt;&lt;li&gt;Bulk data uploading in SQL SERVER 2000 was done using BCP (Bulk copy program’s) format files. Now in SQL SERVER 2005 bulk, data uploading uses XML file format.&lt;/li&gt;&lt;li&gt;In SQL SERVER 2000 there were maximum 16 instances, but in 2005 you can have up to 50 instances.&lt;/li&gt;&lt;li&gt;SERVER 2005 has support of “Multiple Active Result Sets” also called as “MARS”. In previous versions of SQL SERVER 2000 in one connection, you could only have one result set. Now in one SQL connection, you can query and have multiple results set.&lt;/li&gt;&lt;li&gt;In previous versions of SQL SERVER 2000, system catalog was stored in the master database. In SQL SERVER 2005, it’s stored in a resource database which is stored as sys object. You cannot access the sys object directly as in the older version we were accessing the master database.&lt;/li&gt;&lt;li&gt;This is one of the hardware benefits which SQL SERVER 2005 has over SQSERVER 2000 – support of hyper threading. WINDOWS 2003 supports hyper threading; SQL SERVER 2005 can take advantage of the feature unlike SQL SERVER 2000 which did not support hyper threading.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;Hyper threading is a technology developed by INTEL which creates two logical processors on a single physical hardware processor.&lt;/li&gt;&lt;li&gt;SMO will be used for SQL Server Management.&lt;/li&gt;&lt;li&gt;AMO (Analysis Management Objects) to manage Analysis Services servers, data sources, cubes, dimensions, measures, and data mining models. You can mapm AMO in old SQL SERVER with DSO (Decision Support Objects).&lt;/li&gt;&lt;li&gt;Replication is now managed by RMO (Replication Management Objects).&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;SMO, AMO and RMO are all using .NET Framework.&lt;/li&gt;&lt;li&gt;SQL SERVER 2005 uses current user execution context to check rights rather than ownership link chain, which was done in SQL SERVER 2000.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;There is a question on this later see for execution context questions.&lt;/li&gt;&lt;li&gt;In previous versions of SQL SERVER the schema and the user name was same, but in current, the schema is separated from the user. Now the user owns schema.&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt; There are questions on this, refer “Schema” later.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;Ok below are some GUI changes.&lt;/li&gt;&lt;li&gt;Query analyzer is now replaced by query editor.&lt;/li&gt;&lt;li&gt;Business Intelligence development studio will be used to create Business intelligence solutions.&lt;/li&gt;&lt;li&gt;OSQL and ISQL command line utility is replaced by SQLCMD utility.&lt;/li&gt;&lt;li&gt;SQL SERVER Enterprise manager is now replaced by SQL SERVER Management studio.&lt;/li&gt;&lt;li&gt;SERVER Manager which was running in system tray is now replaced by SQL Computer manager.&lt;/li&gt;&lt;li&gt;Database mirror concept is supported in SQL SERVER 2005, which was not present in SQL SERVER 2000.&lt;/li&gt;&lt;li&gt;In SQL SERVER 2005 Indexes can be rebuilt online when the database is in actual production. If you look back in SQL SERVER 2000, you cannot do insert, update, and delete operations when you are building indexes.&lt;/li&gt;&lt;li&gt;(PG) Other than Serializable, Repeatable Read, Read Committed, and Read Uncommitted isolation levels, there is one more new isolation level “Snapshot Isolation level”.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;We will see “Snapshot Isolation level” in detail in the coming questions.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Summarizing: &lt;/strong&gt;The major significant difference between SQL SERVER 2000 and SQL SERVER 2005 is in terms of support of .NET Integration, Snap shot isolation level, Native XML support, handling HTTP request, Web service support and Data partitioning. You do not have to really say all the above points during an interview. A sweet summary and you will rock.&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatareERdiagramstcWhatareERdiagrams"&gt;(Q) What are E-R diagrams?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;E-R diagram also termed as Entity-Relationship diagram shows the relationship between various tables in the database. Example: Tables &lt;code&gt;Customer&lt;/code&gt; and &lt;code&gt;Customer Addresses&lt;/code&gt; have a one to many relationship (i.e. one customer can have multiple addresses) this can be shown using the ER diagram. ER diagrams are drawn during the initial stages of a project to forecast how the database structure will shape up. Below is a screen shot of a sample ER diagram of “Asset Management” which ships free with Access.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image007.png" width="577" border="0" height="514" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.4: Asset management ER diagram.&lt;/div&gt;  &lt;h3&gt;&lt;a name="(Q)_How_many_types_of_relationship_exist_in_database_designingtc_How_many_types_of_Howmanytypes ofrelationshipexistindatabasedesigningtc Howmanytypesofrelationshipexistindatabasedesigningrelationshipexistindatabasedesigning"&gt;(Q) How many Types of Relationship Exist in Database Designing?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;There are three major relationship models:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;One-to-one&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image009.png" width="354" border="0" height="368" hspace="0" /&gt;  &lt;div class="Caption"&gt;Figure 1.5: One-to-One relationship ER diagram&lt;/div&gt; &lt;/li&gt;&lt;li&gt;One-to-many&lt;br /&gt;In this many records in one table correspond to the one record in another table.&lt;br /&gt;Example: Every one customer can have multiple sales. So there exist one-to-many relationships between customer and sales table.  &lt;p&gt;One &lt;code&gt;Asset&lt;/code&gt; can have multiple &lt;code&gt;Maintenance&lt;/code&gt;. So &lt;code&gt;Asset&lt;/code&gt; entity has one-to-many relationship between them as the ER model shows below. &lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image011.png" width="391" border="0" height="358" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.6: One-to-Many Relationship ER diagram&lt;/div&gt; &lt;/li&gt;&lt;li&gt;Many-to-many&lt;br /&gt;In this, one record in one table corresponds to many rows in another table and also vice-versa.&lt;br /&gt;For instance: In a company, one employee can have many skills like Java , C# etc. and also one skill can belong to many employees. &lt;p&gt;Given below is a sample of many-to-many relationship. One employee can have knowledge of multiple &lt;code&gt;Technology&lt;/code&gt;. So in order to implement this, we have one more table &lt;code&gt;Employee Technology&lt;/code&gt; which is linked to the primary key of &lt;code&gt;Employee&lt;/code&gt; and &lt;code&gt;Technology&lt;/code&gt; table.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image013.png" width="410" border="0" height="315" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.7: Many-to-Many Relationship ER diagram&lt;/div&gt; &lt;/li&gt;&lt;/ul&gt;  &lt;h3&gt;&lt;a name="WhatisnormalizationWhataredifferenttypeofnormalizationtcWhatisnormalizationWhataredifferenttypeofnormalization"&gt;(Q) What is Normalization? What are the Different Types of Normalization?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; A regular .NET programmer working on projects often stumbles on this question, which is but obvious. The bad part is sometimes the interviewer can take this as a very basic question to be answered and it can be a turning point for the interview. So let's cram it.&lt;/p&gt;  &lt;p&gt;It is set of rules that have been established to aid in the design of tables that are meant to be connected through relationships. This set of rules is known as Normalization.&lt;/p&gt;  &lt;p&gt;Benefits of Normalizing your database include:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Avoiding repetitive entries &lt;/li&gt;&lt;li&gt;Reducing required storage space &lt;/li&gt;&lt;li&gt;Preventing the need to restructure existing tables to accommodate new data&lt;/li&gt;&lt;li&gt;Increased speed and flexibility of queries, sorts, and summaries&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: During an interview, people expect to answer a maximum of three normal forms and that's what is expected practically. Actually you can normalize database to fifth normal form. But believe this book, answering three normal forms will put you in a decent shape during an interview.&lt;/p&gt;  &lt;p&gt;The three normal forms as follows:&lt;/p&gt;  &lt;h4&gt;First Normal Form&lt;/h4&gt;  &lt;p&gt;For a table to be in first normal form, data must be broken up into the smallest units possible. In addition to breaking data up into the smallest meaningful values, tables in first normal form should not contain repetitions groups of fields. &lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image015.png" width="560" border="0" height="121" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.8: Repeating groups example&lt;/div&gt;  &lt;p&gt;In the above example, &lt;code&gt;city1 &lt;/code&gt;and &lt;code&gt;city2 &lt;/code&gt;are repeating. In order for these tables to be in First normal form, you have to modify the table structure as follows. Also note that the Customer Name is now broken down to first name and last name (First normal form data should be broken down to the smallest unit).&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image017.png" width="512" border="0" height="146" hspace="0" /&gt;  &lt;div class="Caption"&gt;Figure 1.9: Customer table normalized to first normal form&lt;/div&gt;  &lt;h4&gt;Second Normal Form&lt;/h4&gt;  &lt;p&gt;The second normal form states that each field in a multiple field primary key table must be directly related to the entire primary key. In other words, each non-key field should be a fact about all the fields in the primary key.&lt;/p&gt;  &lt;p&gt;In the above table of &lt;code&gt;customer&lt;/code&gt;, &lt;code&gt;city &lt;/code&gt;is not linked to any primary field.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image019.png" width="509" border="0" height="141" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.10: Normalized customer table.&lt;/div&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image021.png" width="144" border="0" height="127" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.11: City is now shifted to a different master table.&lt;/div&gt;  &lt;p&gt;That takes our database to a second normal form.&lt;/p&gt;  &lt;h4&gt;Third Normal Form&lt;/h4&gt;  &lt;p&gt;A non-key field should not depend on another Non-key field. The field &lt;code&gt;Total&lt;/code&gt; is dependent on &lt;code&gt;Unit price&lt;/code&gt; and &lt;code&gt;qty&lt;/code&gt;.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image023.png" width="470" border="0" height="133" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.12: Fill third normal form&lt;/div&gt;  &lt;p&gt;So now the &lt;code&gt;Total&lt;/code&gt; field is removed and is the multiplication of &lt;code&gt;Unit price * Qty&lt;/code&gt;.&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatisdenormalizationtcWhatisdenormalization"&gt;(Q) What is Denormalization? &lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Denormalization is the process of putting one fact in numerous places (it is vice-versa of normalization). Only one valid reason exists for denormalizing a relational design - to enhance performance. The sacrifice to performance is that you increase redundancy in a database.&lt;/p&gt;  &lt;h3&gt;&lt;a name="DBCanyouexplainFourthNormalFormtcDBCanyouexplainFourthNormalForm"&gt;(DB) Can you Explain Fourth Normal Form?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Whenever the interviewer is trying to go above the third normal form, there can be two reasons, ego or to fail you. Three normal forms are really enough, practically anything more than that is an overdose.&lt;/p&gt;  &lt;p&gt;In fourth normal form, it should not contain two or more independent multi-valued facts about an entity and it should satisfy “Third Normal form”. &lt;/p&gt;  &lt;p class="BtextNormal" align="left"&gt;So let us try to see what multi-valued facts are. If there are two or more many-to-many relationship in one entity and they tend to come to one place, it is termed as “multi-valued facts”.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image025.png" width="284" border="0" height="116" hspace="0" /&gt;  &lt;div class="Caption"&gt;Figure 1.13: Multi-valued facts&lt;/div&gt;  &lt;p&gt;In the above table, you can see that there are two many-to-many relationships between &lt;code&gt;Supplier&lt;/code&gt; / &lt;code&gt;Product&lt;/code&gt; and “&lt;code&gt;Supplier &lt;/code&gt;/ &lt;code&gt;Location&lt;/code&gt; (or in short multi-valued facts). In order for the above example to satisfy the fourth normal form, both the many-to-many relationships should go in different tables.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image027.png" width="377" border="0" height="114" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.14: Normalized to Fourth Normal form.&lt;/div&gt;  &lt;h3&gt;&lt;a name="CanyouexplainFifthNormalFormDBCanyouexplainFifthNormalForm"&gt;(DB) Can you Explain Fifth Normal Form?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;UUUHHH if you get this question after joining the company, do ask him if he himself really uses it?&lt;/p&gt;  &lt;p&gt;Fifth normal form deals with reconstructing information from smaller pieces of information. These smaller pieces of information can be maintained with less redundancy.&lt;/p&gt;  &lt;p&gt;Example: &lt;code&gt;Dealers&lt;/code&gt; sell &lt;code&gt;Product&lt;/code&gt; which can be manufactured by various &lt;code&gt;Companies&lt;/code&gt;. &lt;code&gt;Dealers&lt;/code&gt; in order to sell the &lt;code&gt;Product&lt;/code&gt; should be registered with the &lt;code&gt;Company&lt;/code&gt;. So these three entities have a mutual relationship within them.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image029.png" width="359" border="0" height="106" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.15: Not in Fifth Normal Form.&lt;/div&gt;  &lt;p&gt;The above table shows some sample data. If you observe closely, a single record is created using lot of small information. For instance: &lt;code&gt;JM Associate&lt;/code&gt; can sell sweets under the following two conditions:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;code&gt;JM Associate&lt;/code&gt; should be an authorized dealer of &lt;code&gt;Cadbury&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;Sweets&lt;/code&gt; should be manufactured by &lt;code&gt;Cadbury&lt;/code&gt; company&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;These two smaller bits of information form one record of the above given table. So in order for the above information to be “Fifth Normal Form” all the smaller information should be in three different places. Below is the complete fifth normal form of the database.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image031.png" width="484" border="0" height="224" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.16: Complete Fifth Normal Form&lt;/div&gt;  &lt;h3&gt;&lt;a name="WhatisthedifferencebetweenFourthandFifthnormalformtcDBWhatsthedifferencebetweenFourthandFifthnormalform"&gt;(DB) What is the Difference between Fourth and Fifth normal form?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; There is a huge similarity between Fourth and Fifth normal form, i.e. they address the problem of “Multi-Valued facts”.&lt;/p&gt;  &lt;p&gt;“Fifth normal form” multi-valued facts are interlinked and “Fourth normal form” values are independent. For instance in the above two questions &lt;code&gt;Supplier&lt;/code&gt;/&lt;code&gt;Product&lt;/code&gt; and &lt;code&gt;Supplier&lt;/code&gt;/&lt;code&gt;Location&lt;/code&gt; are not linked. While in fifth form, the &lt;code&gt;Dealer&lt;/code&gt;/&lt;code&gt;Product&lt;/code&gt;/&lt;code&gt;Companies&lt;/code&gt; are completely linked.&lt;/p&gt;  &lt;h3&gt;&lt;a name="HaveyouheardaboutsixthnormalformtcDBHaveyouheardaboutsixthnormalform"&gt;(DB) Have you Heard about Sixth Normal Form?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Arrrrggghhh yes there exists a sixth normal form also. But note guys you can skip this statement. Just in case you want to impress the interviewer...&lt;/p&gt;  &lt;p&gt;If you want a relational system in conjunction with time, you use sixth normal form. At this moment SQL Server does not support it directly.&lt;/p&gt;  &lt;h3&gt;&lt;a name="WhatisExtentandPagetcWhatisExtentandPage"&gt;(Q) What is Extent and Page?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Twist: What is the relationship between Extent and Page?&lt;/p&gt;  &lt;p&gt;Extent is a basic unit of storage to provide space for tables. Every extent has a number of data pages. As new records are inserted new data, pages are allocated. There are eight data pages in an extent. So as soon as the eight pages are consumed, it allocates a new extent with data pages. &lt;/p&gt;  &lt;p&gt;While extent is basic unit storage from a database point of view, page is a unit of allocation within extent.&lt;/p&gt;  &lt;h3&gt;&lt;a name="DBWhatarethedifferentsectionsinPagetcDBWhatarethedifferentsectionsinPage"&gt;(DB) What are the Different Sections in Page?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Page has three important sections: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Page header&lt;/li&gt;&lt;li&gt;Actual data i.e. Data row&lt;/li&gt;&lt;li&gt;Row pointers or Row offset&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;Page header has information like timestamp, next page number, previous page number etc. &lt;/p&gt;  &lt;p&gt;Data rows are where your actual row data is stored. For every data row, there is a row offset which points to that data row.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image033.png" width="397" border="0" height="391" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.17: General view of a Extent&lt;/div&gt;  &lt;h3&gt;&lt;a name="WhatarepagesplitstcWhatarepagesplits"&gt;(Q) What are Page Splits?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Pages are contained in extent. Every extent will have around eight data pages. But all the eight data pages are not created at once; they are created depending on data demand. So when a page becomes full it creates a new page, this process is called as “Page Split”.&lt;/p&gt;  &lt;h3&gt;&lt;a name="InwhichfilesdoesactuallySQLServerstoredatatcInwhichfilesdoesactuallySQLServerstoredata"&gt;(Q) In which Files does SQL Server Actually Store Data?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Any SQL Server database is associated with two kinds of files: &lt;em&gt;*.mdf&lt;/em&gt; and &lt;em&gt;*.ldf&lt;/em&gt;. &lt;em&gt;*.mdf&lt;/em&gt; files are actual physical database files where your data is stored finally.&lt;em&gt; *.ldf&lt;/em&gt; (LOG) files are actually data, which is recorded from the last time data was committed in the database.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image035.png" width="570" border="0" height="416" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.18: MDF and LDF files.&lt;/div&gt;  &lt;h3&gt;(Q) What is Collation in SQL Server?&lt;/h3&gt;  &lt;p&gt;Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types, and character width.&lt;/p&gt; &lt;img src="http://www.codeproject.com/KB/database/SQLInterviewQuestions/image037.png" width="410" border="0" height="234" hspace="0" /&gt;  &lt;div class="caption"&gt;Figure 1.19: Collation according to language&lt;/div&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Different languages will have different sort orders.&lt;/p&gt;  &lt;h4&gt;Case Sensitivity&lt;/h4&gt;  &lt;p&gt;If &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;, etc. are treated in the same way, then it is case-insensitive. A computer treats &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;a&lt;/code&gt; differently because it uses ASCII code to differentiate the input. The ASCII value of &lt;code&gt;A&lt;/code&gt; is 65, while &lt;code&gt;a&lt;/code&gt; is 97. The ASCII value of &lt;code&gt;B&lt;/code&gt; is 66 and &lt;code&gt;b&lt;/code&gt; is 98.&lt;/p&gt;  &lt;h4&gt;Accent Sensitivity&lt;/h4&gt;  &lt;p&gt;If &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;o&lt;/code&gt; and &lt;code&gt;O&lt;/code&gt; are treated in the same way, then it is accent-insensitive. A computer treats &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;A&lt;/code&gt; differently because it uses ASCII code for differentiating the input. The ASCII value of &lt;code&gt;a&lt;/code&gt; is 97 and &lt;code&gt;A&lt;/code&gt; 225. The ASCII value of &lt;code&gt;o&lt;/code&gt; is 111 and &lt;code&gt;O&lt;/code&gt; is 243.&lt;/p&gt;  &lt;h4&gt;Kana Sensitivity&lt;/h4&gt;  &lt;p&gt;When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive. &lt;/p&gt;  &lt;h4&gt;Width Sensitivity&lt;/h4&gt;  &lt;p&gt;When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.&lt;/p&gt;  &lt;h3&gt;&lt;a name="DBCanwehaveadifferentcollationfordatabaseandtabletcDBCanwehaveadifferentcollationfordatabaseandtable"&gt;(DB) Can We Have a Different Collation for Database and Table?&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Yes, you can specify different collation sequence for both the entities differently.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-2614939263446629220?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/2614939263446629220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=2614939263446629220' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/2614939263446629220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/2614939263446629220'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/sql-server-interview-questions.html' title='SQL Server Interview Questions'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-8926481137539081779</id><published>2008-09-18T06:33:00.000-07:00</published><updated>2008-09-18T06:35:11.891-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.Net InterView Questions'/><title type='text'>Paper-1</title><content type='html'>&lt;ol style="margin-top: 15px;"&gt;&lt;li&gt; &lt;div align="left"&gt;&lt;b&gt;Describe the role of &lt;i&gt;inetinfo.exe, aspnet_isapi.dll &lt;/i&gt;and&lt;i&gt;aspnet_wp.exe&lt;/i&gt; in the page loading process&lt;/b&gt;.&lt;br /&gt;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.&lt;br /&gt; &lt;/div&gt; &lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s the difference between Response.Write() andResponse.Output.Write()?&lt;br /&gt;&lt;/b&gt;Response.Output.Write() allows you to write formatted output.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What methods are fired during the page load?&lt;br /&gt;&lt;/b&gt;Init() - when the page is instantiated&lt;br /&gt;Load() - when the page is loaded into server memory&lt;br /&gt;PreRender() - the brief moment before the page is displayed to the user as HTML&lt;br /&gt;Unload() - when page finishes loading.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;strong&gt;When during the page processing cycle is ViewState available?&lt;/strong&gt;&lt;br /&gt;After the Init() and before the Page_Load(), or OnLoad() for a control.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What namespace does the Web page belong in the .NET Framework class hierarchy?&lt;br /&gt;&lt;/b&gt;System.Web.UI.Page&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Where do you store the information about the user’s locale?&lt;br /&gt;&lt;/b&gt;System.Web.UI.Page.Culture&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?&lt;br /&gt;&lt;/b&gt;CodeBehind is relevant to Visual Studio.NET only.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s a bubbled event?&lt;br /&gt;&lt;/b&gt;When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Suppose you want a certain ASP.NET function executed on MouseOver for a certain button.  Where do you add an event handler?&lt;br /&gt;&lt;/b&gt;Add an OnMouseOver attribute to the button.  Example: &lt;span&gt;btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");&lt;/span&gt;&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What data types do the RangeValidator control support?&lt;br /&gt;&lt;/b&gt;Integer, String, and Date.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Explain the differences between Server-side and Client-side code?&lt;br /&gt;&lt;/b&gt;Server-side code executes on the server.  Client-side code executes in the client's browser.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What type of code (server or client) is found in a Code-Behind class?&lt;br /&gt;&lt;/b&gt;The answer is server-side code since code-behind is executed on the server.  However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser.  But just to be clear, code-behind executes on the server, thus making it server-side code.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Should user input data validation occur server-side or client-side?  Why?&lt;br /&gt;&lt;/b&gt;All user input data validation should occur on the server at a minimum.  Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What is the difference between Server.Transfer and Response.Redirect?  Why would I choose one over the other?&lt;br /&gt;&lt;/b&gt;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.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?&lt;br /&gt;&lt;/b&gt;&lt;span&gt;Valid answers are:&lt;br /&gt;·&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;·&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;A DataSet is designed to work without any continuing connection to the original data source.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;·&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Data in a DataSet is bulk-loaded, rather than being loaded on demand.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;·&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;There's no concept of cursor types in a DataSet.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;·&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;DataSets have no current record pointer You can use For Each loops to move through the data.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;·&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;You can store many edits in a DataSet, and write them to the original data source in a single operation.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;·&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.&lt;br /&gt; &lt;/span&gt;  &lt;/li&gt;&lt;li&gt;&lt;strong&gt;What is the Global.asax used for?&lt;br /&gt;&lt;/strong&gt;The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What are the Application_Start and Session_Start subroutines used for?&lt;br /&gt;&lt;/b&gt;This is where you can set the specific variables for the Application and Session objects.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Can you explain what inheritance is and an example of when you might use it?&lt;br /&gt;&lt;/b&gt;When you want to inherit (use the functionality of) another class.  Example: With a base class named Employee, a Manager class could be derived from the Employee base class.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Whats an assembly?&lt;br /&gt;&lt;/b&gt;Assemblies are the building blocks of the .NET framework.&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconassembliesoverview.asp"&gt; Overview of assemblies from MSDN&lt;/a&gt;&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Describe the difference between inline and code behind.&lt;br /&gt;&lt;/b&gt;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.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Explain what a diffgram is, and a good use for one?&lt;br /&gt;&lt;/b&gt;The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML.  A good use is reading database data to an XML file to be sent to a Web Service.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Whats MSIL, and why should my developers need an appreciation of it if at all?&lt;br /&gt;&lt;/b&gt;MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.  MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Which method do you invoke on the DataAdapter control to load your generated dataset with data?&lt;br /&gt;&lt;/b&gt;The Fill() method.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Can you edit data in the Repeater control?&lt;br /&gt;&lt;/b&gt;No, it just reads the information from its data source&lt;strong&gt;.&lt;/strong&gt;&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Which template must you provide, in order to display data in a Repeater control?&lt;br /&gt;&lt;/b&gt;ItemTemplate.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;How can you provide an alternating color scheme in a Repeater control?&lt;br /&gt;&lt;/b&gt;Use the AlternatingItemTemplate&lt;strong&gt;.&lt;/strong&gt;&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?&lt;br /&gt;&lt;/b&gt;You must set the DataSource property and call the DataBind method.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;What base class do all Web Forms inherit from?&lt;br /&gt;&lt;/b&gt;The Page class.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Name two properties common in every validation control?&lt;br /&gt;&lt;/b&gt;ControlToValidate property and Text property.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?&lt;br /&gt;&lt;/b&gt;DataTextField property.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Which control would you use if you needed to make sure the values in two different controls matched?&lt;br /&gt;&lt;/b&gt;CompareValidator control.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;How many classes can a single .NET DLL contain?&lt;br /&gt;&lt;/b&gt;It can contain many classes.&lt;br /&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;span style="font-size:130%;"&gt;Web Service Questions&lt;/span&gt;&lt;/p&gt; &lt;ol&gt;&lt;li&gt;&lt;b&gt;What is the transport protocol you use to call a Web service?&lt;br /&gt;&lt;/b&gt;SOAP (Simple Object Access Protocol) is the preferred protocol.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;True or False: A Web service can only be written in .NET?&lt;br /&gt;&lt;/b&gt;False&lt;b&gt;&lt;br /&gt; &lt;/b&gt;  &lt;/li&gt;&lt;li&gt;&lt;b&gt;What does WSDL stand for?&lt;br /&gt;&lt;/b&gt;Web Services Description Language.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;Where on the Internet would you look for Web services?&lt;br /&gt;&lt;/b&gt;&lt;a href="http://www.uddi.org/"&gt;http://www.uddi.org&lt;/a&gt;&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;b&gt;True or False: To test a Web service you must create a Windows application or Web application to consume this service?&lt;br /&gt;&lt;/b&gt;&lt;span&gt;False, the web service comes with a test page and it provides HTTP-GET method to test.&lt;br /&gt; &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;span style="font-size:130%;"&gt;State Management Questions&lt;/span&gt;&lt;/p&gt; &lt;ol&gt;&lt;li&gt;&lt;strong&gt;What is ViewState?&lt;br /&gt;&lt;/strong&gt;ViewState allows the state of objects (serializable) to be stored in a hidden field on the page.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.  ViewState is used the retain the state of server-side objects between postabacks.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;strong&gt;What is the lifespan for items stored in ViewState?&lt;br /&gt;&lt;/strong&gt;Item stored in ViewState exist for the life of the current page.  This includes postbacks (to the same page).&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;strong&gt;What does the "EnableViewState" property do?  Why would I want it on or off?&lt;br /&gt;&lt;/strong&gt;It allows the page to save the users input on a form across postbacks.  It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser.  When the page is posted back to the server the server control is recreated with the state stored in viewstate.&lt;br /&gt;   &lt;/li&gt;&lt;li&gt;&lt;strong&gt;What are the different types of Session state management options available with ASP.NET?&lt;/strong&gt;&lt;br /&gt;ASP.NET provides In-Process and Out-of-Process state management.  In-Process stores the session in memory on the web server.  This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same 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.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-8926481137539081779?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/8926481137539081779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=8926481137539081779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/8926481137539081779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/8926481137539081779'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/paper-1.html' title='Paper-1'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-6532590814577451137</id><published>2008-09-18T06:21:00.000-07:00</published><updated>2008-09-18T06:22:30.750-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.Net Page life Cycle'/><title type='text'>ASP.Net Page life Cycle</title><content type='html'>&lt;span id="intelliTXT"&gt;&lt;h2&gt;Introduction&lt;/h2&gt;This article describes the life cycle of the page from the moment the URL is hit from the web browser till the HTML code is generated and sent to the web browser. Let us start by looking at some keywords that are involved in the life cycle of the page.&lt;br /&gt;&lt;h2&gt;Background &lt;/h2&gt;&lt;p&gt;&lt;strong&gt;IIS&lt;/strong&gt;: IIS (Internet Information Server) is a complete Web server that makes it possible to quickly and easily deploy powerful Web sites and applications. It is the default web server used with .NET. When a Web server (for ASP.NET applications, typically IIS) receives a request, it examines the file-name extension of the requested file, determines which ISAPI extension should handle the request, and then passes the request to the appropriate ISAPI extension. (By default, ASP.NET handles file name extensions that have been mapped to it, such as .aspx, .ascx, .ashx, and .asmx.)&lt;br /&gt;&lt;em&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;:&lt;br /&gt;a. If a file name extension has not been mapped to ASP.NET, ASP.NET will not receive the request. It will be handled by the IIS. The requested page/image/file is returned without any processing.&lt;br /&gt;b. If you create a custom handler to service a particular file name extension, you must map the extension to ASP.NET in IIS and also register the handler in your application's Web.config file.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ASPNET_ISAPI.DLL&lt;/strong&gt;: This dll is the ISAPI extension provided with ASP.NET to process the web page requests. IIS loads this dll and sends the page request to this dll. This dll loads the HTTPRuntime for further processing.&lt;br /&gt;ASPNET_WP.EXE: Each worker process (ASPNET_WP.EXE) contains an Application Pool. Each Application Pool can contain any number of Applications. Application Pool is also called as AppDomain. When a web page is requested, IIS looks for the application pool under which the current application is running and forwards the request to respective worker process.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP Pipeline&lt;/strong&gt;: HTTP Pipeline is the general-purpose framework for server-side HTTP programming that serves as the foundation for ASP.NET pages as well as Web Services. All the stages involved from creating HTTP Runtime to HTTP Handler is called HTTP Pipeline.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP Runtime&lt;/strong&gt;: Each AppDomain has its own instance of the HttpRuntime class—the entry point in the pipeline. The HttpRuntime object initializes a number of internal objects that will help carry the request out. The HttpRuntime creates the context for the request and fills it up with any HTTP information specific to the request. The context is represented by an instance of the HttpContext class. Another helper object that gets created at such an early stage of the HTTP runtime setup is the text writer—to contain the response text for the browser. The text writer is an instance of the HttpWriter class and is the object that actually buffers any text programmatically sent out by the code in the page. Once the HTTP runtime is initialized, it finds an application object to fulfill the request. The HttpRuntime object examines the request and figures out which application it was sent to (from the pipeline's perspective, a virtual directory is an application).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP Context&lt;/strong&gt;: This is created by HTTP Runtime. The HttpContext class contains objects that are specific to the current page request, such as the HttpRequest and HttpResponse objects. You can use this class to share information between pages. It can be accessed with Page.Context property in the code.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;HTTP Request&lt;/strong&gt;: Provides access to the current page request, including the request headers, cookies, client certificate, query string, and so on. You can use this class to read what the browser has sent. It can be accessed with Page.Request property in the code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP Response&lt;/strong&gt;: Provides access to the output stream for the current page. You can use this class to inject text into the page, to write cookies, and more. It can be accessed with Page.Response property in the code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP Application&lt;/strong&gt;: An application object is an instance of the HttpApplication class—the class behind the global.asax file. HTTPRuntime uses HttpApplicationFactory to create the HTTPApplication object. The main task accomplished by the HTTP application manager is finding out the class that will actually handle the request. When the request is for an .aspx resource, the handler is a page handler—namely, an instance of a class that inherits from Page. The association between types of resources and types of handlers is stored in the configuration file of the application. More exactly, the default set of mappings is defined in the &lt;httphandlers&gt; section of the machine.config file. However, the application can customize the list of its own HTTP handlers in the local web.config file. The line below illustrates the code that defines the HTTP handler for .aspx resources.&lt;br /&gt;&lt;br /&gt;&lt;add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HttpApplicationFactory&lt;/strong&gt;: Its main task consists of using the URL information to find a match between the virtual directory of the URL and a pooled HttpApplication object.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP Module&lt;/strong&gt;: An HTTP module is an assembly that is called on every request that is made to your application. HTTP modules are called as part of the ASP.NET request pipeline and have access to life-cycle events throughout the request. HTTP modules let you examine incoming and outgoing requests and take action based on the request. They also let you examine the outgoing response and modify it. ASP.NET uses modules to implement various application features, which includes forms authentication, caching, session state, and client script services. In each case, when those services are enabled, the module is called as part of a request and performs tasks that are outside the scope of any single page request. Modules can consume application events and can raise events that can be handled in the Global.asax file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP Handler&lt;/strong&gt;: An ASP.NET HTTP handler is the process that runs in response to a request that is made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page handler. We can write our own handler and handler factory if we want to handle the page request in a different manner.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;: HTTP modules differ from HTTP handlers. An HTTP handler returns a response to a request that is identified by a file name extension or family of file name extensions. In contrast, an HTTP module is invoked for all requests and responses. It subscribes to event notifications in the request pipeline and lets you run code in registered event handlers. The tasks that a module is used for are general to an application and to all requests for resources in the application.&lt;/em&gt;&lt;/p&gt;&lt;h2&gt;Life Cycle of Page &lt;/h2&gt;&lt;p&gt;1.  Web page request comes from browser.&lt;br /&gt;2.  IIS maps the ASP.NET file extensions to ASPNET_ISAPI.DLL, an ISAPI extension provided with ASP.NET.&lt;br /&gt;3.  ASPNET_ISAPI.DLL forwards the request to the ASP.NET worker process (ASPNET_WP.EXE or W3P.EXE).&lt;br /&gt;4.  ISAPI loads HTTPRuntime and passes the request to it. Thus, HTTP Pipelining has begun.&lt;br /&gt;5.  HTTPRuntime uses HttpApplicationFactory to either create or reuse the HTTPApplication object.&lt;br /&gt;6.  HTTPRuntime creates HTTPContext for the current request. HTTPContext internally maintains HTTPRequest and HTTPResponse.&lt;br /&gt;7.  HTTPRuntime also maps the HTTPContext to the HTTPApplication which handles the application level events.&lt;br /&gt;8.  HTTPApplication runs the HTTPModules for the page requests.&lt;br /&gt;9.  HTTPApplication creates HTTPHandler for the page request. This is the last stage of HTTPipelining.&lt;br /&gt;10. HTTPHandlers are responsible to process request and generate corresponding response messages.&lt;br /&gt;11. Once the request leaves the HTTPPipeline, page level events begin.&lt;br /&gt;12. Page Events are as follows: PreInit, Init, InitComplete, PreLoad, Load, Control evetns (Postback events), Load Complete, PreRender, SaveStateComplete, Render and Unload.&lt;br /&gt;13. HTTPHandler generates the response with the above events and sends back to the IIS which in turn sends the response to the client browser.&lt;br /&gt;&lt;br /&gt;                &lt;img src="http://www.codeproject.com/KB/aspnet/PageLifeCycle/Page_Life_cycle.gif" alt="Page_Life_cycle.gif" width="152" height="175" /&gt;            &lt;img src="http://www.codeproject.com/KB/aspnet/PageLifeCycle/HTTP_Pipeline.gif" alt="HTTP_Pipeline.gif" width="297" height="130" /&gt;&lt;/p&gt;&lt;h2&gt;Events in the life cycle of page &lt;/h2&gt;&lt;p&gt;&lt;strong&gt;PreInit&lt;/strong&gt;: All the Pre and Post events are introduced as part of .NET Framework 2.0. As the name suggests this event is fired before the Init method is fired. Most common functionalities implemented in this method include&lt;br /&gt;&lt;br /&gt;   a. Check the IsPostBack property&lt;br /&gt;   b. Set the master page dynamically&lt;br /&gt;   c. Set the theme property of the page dynamically&lt;br /&gt;   d. Read or Set the profile property values.&lt;br /&gt;   e. Re-create the dynamic controls&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Init&lt;/strong&gt;: This event is raised after all controls in the page are initialized and any skin settings have been applied. This event is used to read or initialize control properties. It can be used to register events for some controls for which the events are not specified in the aspx page.&lt;br /&gt;Ex: OnClick event of the Button can be registered in the Init rather than specifying in the OnClick property of the Button in the aspx page.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;InitComplete&lt;/strong&gt;: Use this event for processing tasks that require all initialization be complete.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;PreLoad&lt;/strong&gt;: Use this event if you need to perform processing on your page or control before the Load event. After the Page raises this event, it loads view state for itself and all controls, and then processes any postback data included with the Request instance.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Load&lt;/strong&gt;: The Page calls the OnLoad event method on the Page, then recursively does the same for each child control, which does the same for each of its child controls until the page and all controls are loaded. Use the OnLoad event method to set properties in controls and establish database connections.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Control events&lt;/strong&gt;: Use these events to handle specific control events, such as a Button control's Click event or a TextBox control's TextChanged event.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;LoadComplete&lt;/strong&gt;: Use this event for tasks that require that all other controls on the page be loaded.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;PreRender&lt;/strong&gt;: This is the last event raised before the HTML code is generated for the page. The PreRender event also occurs for each control on the page. Use the event to make final changes to the contents of the page or its controls.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;SaveStateComplete&lt;/strong&gt;: Before this event occurs, ViewState has been saved for the page and for all controls. Any changes to the page or controls at this point will be ignored.&lt;br /&gt;Use this event perform tasks that require view state to be saved, but that do not make any changes to controls.  &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Render&lt;/strong&gt;: This is the stage where the HTML code for the page is rendered. The Page object calls the Render method of each control at this stage. All ASP.NET Web server controls have a Render method that writes out the control's markup that is sent to the browser.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;UnLoad&lt;/strong&gt;: This event occurs for each control and then for the page. In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections.&lt;br /&gt;For the page itself, use this event to do final cleanup work, such as closing open files and database connections, or finishing up logging or other request-specific tasks. &lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-6532590814577451137?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/6532590814577451137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=6532590814577451137' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/6532590814577451137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/6532590814577451137'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/aspnet-page-life-cycle.html' title='ASP.Net Page life Cycle'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-6861119661099912619</id><published>2008-09-12T22:37:00.000-07:00</published><updated>2008-09-12T22:37:08.176-07:00</updated><title type='text'>Edging DotNet: Use Secured Secured String for password</title><content type='html'>&lt;a href="http://edgingdotnet.blogspot.com/2008/09/use-secured-secured-string-for-password.html#links"&gt;Edging DotNet: Use Secured Secured String for password&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-6861119661099912619?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://edgingdotnet.blogspot.com/2008/09/use-secured-secured-string-for-password.html#links' title='Edging DotNet: Use Secured Secured String for password'/><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/6861119661099912619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=6861119661099912619' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/6861119661099912619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/6861119661099912619'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/edging-dotnet-use-secured-secured.html' title='Edging DotNet: Use Secured Secured String for password'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-7099853560280600266</id><published>2008-09-12T03:28:00.000-07:00</published><updated>2008-09-12T03:31:21.391-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Secured String'/><title type='text'>Use Secured Secured String for password</title><content type='html'>&lt;h3 class="post-title entry-title"&gt; &lt;a href="http://dotnetfacts.blogspot.com/2008/04/how-to-use-strings-in-secure-manner.html"&gt;How to: Use strings in a secure manner with SecureString class&lt;/a&gt; &lt;/h3&gt;   The classic &lt;strong&gt;System.String&lt;/strong&gt; type doesn’t provide enough security for storing sensitive data like passwords, credit card numbers or personal information. If a String object contains sensitive information, there is a risk the information could be revealed after it is used because your application cannot delete the data from computer memory. Starting with the &lt;strong&gt;.NET Framework 2.0&lt;/strong&gt; the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.securestring%28VS.80%29.aspx"&gt;SecureString&lt;/a&gt; class is available. It was designed to provide encryption for sensitive data and other useful functions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;System.String&lt;/h3&gt;  The most important factors that don’t recommend the &lt;strong&gt;System.String&lt;/strong&gt; type as a secure type are: &lt;br /&gt; &lt;ul&gt;&lt;li&gt; &lt;strong&gt;System.String is not encrypted&lt;/strong&gt;. Anyone who can read your process' memory will be able to see the value of the string easily. Also, if your process gets swapped out to disk, the unencrypted contents of the string will be sitting in your swap file. &lt;/li&gt;&lt;li&gt; &lt;strong&gt;System.String is immutable&lt;/strong&gt;. Because of this you can not modify an existing string without create a copy of it first and you can not clear the content of a string. You may end up with several copies of your sensitive data in memory which are hard to hide from a possible attacker. &lt;/li&gt;&lt;li&gt; &lt;strong&gt;System.String can be moved around&lt;/strong&gt; in memory by the Garbage Collector (GC). This happens because of the Garbage Collector's &lt;a href="http://msdn2.microsoft.com/en-us/library/ms973837.aspx"&gt;generations&lt;/a&gt; mechanism. &lt;/li&gt;&lt;li&gt; &lt;strong&gt;System.String can’t be disposed on demand&lt;/strong&gt;. No one can predict when a specific string will be reclaimed by the &lt;strong&gt;Garbage Collector&lt;/strong&gt; (GC). It is possible that some strings to survive long time after the application was closed. &lt;/li&gt;&lt;/ul&gt;  &lt;h3&gt;The byte array workaround&lt;/h3&gt;  Before .NET 2.0, the recommended way to handle sensitive data was to use the &lt;strong&gt;byte array&lt;/strong&gt;. A byte array can be handled almost in a string manner but with some extra &lt;strong&gt;advantages&lt;/strong&gt;: &lt;br /&gt; &lt;ul&gt;&lt;li&gt; Each byte from the byte array can be &lt;strong&gt;encrypted and decrypted&lt;/strong&gt; using any encoding algorithm. &lt;/li&gt;&lt;li&gt; We can &lt;strong&gt;clean-up&lt;/strong&gt; the content of it. &lt;/li&gt;&lt;li&gt; We can &lt;strong&gt;dispose&lt;/strong&gt; a byte array on demand. &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;The SecureString class&lt;/h3&gt;  Let’s see what are the advantages that recommend the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.securestring%28VS.80%29.aspx"&gt;SecureString&lt;/a&gt; class to be better than &lt;strong&gt;Sytem.String&lt;/strong&gt; or even than the &lt;strong&gt;byte array&lt;/strong&gt; method:  &lt;br /&gt; &lt;ul&gt;&lt;li&gt; A &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.securestring%28VS.80%29.aspx"&gt;SecureString&lt;/a&gt; object is &lt;strong&gt;similar to a String&lt;/strong&gt; object in that it has a text value. So it helps you to write cleaner code then the byte array method. &lt;/li&gt;&lt;li&gt; The value of a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.securestring%28VS.80%29.aspx"&gt;SecureString&lt;/a&gt; object is &lt;strong&gt;automatically encrypted&lt;/strong&gt; when its value is initialized or modified. It will be automatically decrypted when it will be accessed. &lt;/li&gt;&lt;li&gt; The value of a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.securestring%28VS.80%29.aspx"&gt;SecureString&lt;/a&gt; can be modified until your application marks it as read-only. You'll find &lt;strong&gt;AppendChar()&lt;/strong&gt;, &lt;strong&gt;InsertAt()&lt;/strong&gt;, &lt;strong&gt;RemoveAt()&lt;/strong&gt;, and &lt;strong&gt;SetAt()&lt;/strong&gt; methods as well as a &lt;strong&gt;Length&lt;/strong&gt; property. &lt;/li&gt;&lt;li&gt; The value of a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.securestring%28VS.80%29.aspx"&gt;SecureString&lt;/a&gt; &lt;strong&gt;can be deleted&lt;/strong&gt; from computer memory by either your application or the .NET Framework &lt;strong&gt;Garbage Collector&lt;/strong&gt;. This includes clearing the entire content. &lt;/li&gt;&lt;li&gt; The &lt;strong&gt;Garbage Collector&lt;/strong&gt; (GC) &lt;strong&gt;will not move&lt;/strong&gt; the encrypted string around in memory, so you never have to worry about multiple copies of your string sitting in your address space. &lt;/li&gt;&lt;/ul&gt;  The &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.securestring%28VS.80%29.aspx"&gt;SecureString&lt;/a&gt; class has no members that inspect, compare, or convert the value of a &lt;strong&gt;SecureString&lt;/strong&gt;. The absence of such members helps protect the value of the instance from accidental or malicious exposure. Anyway you can you can use the appropriate members of the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.marshal.aspx"&gt;Marshal&lt;/a&gt; class, such as the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.marshal.securestringtobstr%28VS.80%29.aspx"&gt;SecureStringToBSTR&lt;/a&gt; method, to manipulate the value of a &lt;strong&gt;SecureString&lt;/strong&gt; object. &lt;br /&gt;&lt;br /&gt;Let me show you an example of how a &lt;strong&gt;SecureString&lt;/strong&gt; should be used: &lt;br /&gt;&lt;br /&gt; &lt;!-- {\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 \cf2 static\cf0  \cf2 void\cf0  Main(\cf2 string\cf0 [] args)\par ??        \{\par ??            \cf10 Console\cf0 .WriteLine(\cf13 "Please enter your password to be encrypted:"\cf0 );\par ??            System.Security.\cf10 SecureString\cf0  password = ReadPassword();\par ??            \cf10 Console\cf0 .WriteLine(\cf13 "Decripted password:"\cf0 );\par ??            PrintPassword(password);\par ??            \cf10 Console\cf0 .WriteLine(\cf13 "Press any key to quit"\cf0 );\par ??            \cf10 Console\cf0 .ReadKey();\par ??        \}\par ??\par ??        \cf2 public\cf0  \cf2 static\cf0  System.Security.\cf10 SecureString\cf0  ReadPassword()\par ??        \{\par ??            System.Security.\cf10 SecureString\cf0  password = \cf2 new\cf0  System.Security.\cf10 SecureString\cf0 ();                        \par ??            \cf10 ConsoleKeyInfo\cf0  key = \cf10 Console\cf0 .ReadKey(\cf2 true\cf0 );\par ??            \cf2 while\cf0  (key.Key != \cf10 ConsoleKey\cf0 .Enter)\par ??            \{\par ??                password.AppendChar(key.KeyChar);\par ??                key = \cf10 Console\cf0 .ReadKey(\cf2 true\cf0 );\par ??            \}\par ??                        \par ??            password.MakeReadOnly(); \cf11 // make the password read-only.\par ??\cf0             \cf2 return\cf0  password; \cf11 // return the encrypted password.\par ??\cf0         \}\par ??\par ??        \cf2 public\cf0  \cf2 static\cf0  \cf2 void\cf0  PrintPassword(System.Security.\cf10 SecureString\cf0  password)\par ??        \{\par ??            \cf11 // Uncrypt the password and get a reference to it...\par ??\cf0             \cf10 IntPtr\cf0  bstr = \cf10 Marshal\cf0 .SecureStringToBSTR(password);\par ??\par ??            \cf2 try\par ??\cf0             \{\par ??                \cf11 // Printing the uncrypted password...\par ??\cf0                 \cf10 Console\cf0 .WriteLine(\cf10 Marshal\cf0 .PtrToStringBSTR(bstr));\par ??            \}\par ??\par ??            \cf2 finally\par ??\cf0             \{\par ??                \cf10 Marshal\cf0 .ZeroFreeBSTR(bstr);\par ??            \}\par ??        \}} --&gt; &lt;div style="background: whitesmoke none repeat scroll 0% 0%; font-family: Courier New; font-size: 9pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue;"&gt;string&lt;/span&gt;[] args)&lt;/p&gt; &lt;p style="margin: 0px;"&gt;{&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: maroon;"&gt;"Please enter your password to be encrypted:"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;SecureString&lt;/span&gt; password = ReadPassword();&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: maroon;"&gt;"Decripted password:"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    PrintPassword(password);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: maroon;"&gt;"Press any key to quit"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.ReadKey();&lt;/p&gt; &lt;p style="margin: 0px;"&gt;}&lt;/p&gt; &lt;p style="margin: 0px;"&gt; &lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: teal;"&gt;SecureString&lt;/span&gt; ReadPassword()&lt;/p&gt; &lt;p style="margin: 0px;"&gt;{&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;SecureString&lt;/span&gt; password = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;SecureString&lt;/span&gt;();                        &lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;ConsoleKeyInfo&lt;/span&gt; key = &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.ReadKey(&lt;span style="color: blue;"&gt;true&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;while&lt;/span&gt; (key.Key != &lt;span style="color: teal;"&gt;ConsoleKey&lt;/span&gt;.Enter)&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    {&lt;/p&gt; &lt;p style="margin: 0px;"&gt;        password.AppendChar(key.KeyChar);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;        key = &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.ReadKey(&lt;span style="color: blue;"&gt;true&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    }&lt;/p&gt; &lt;p style="margin: 0px;"&gt; &lt;/p&gt; &lt;p style="margin: 0px;"&gt;    password.MakeReadOnly(); &lt;span style="color: green;"&gt;// make the password read-only.&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;return&lt;/span&gt; password; &lt;span style="color: green;"&gt;// return the encrypted password.&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;}&lt;/p&gt; &lt;p style="margin: 0px;"&gt; &lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; PrintPassword(&lt;span style="color: teal;"&gt;SecureString&lt;/span&gt; password)&lt;/p&gt; &lt;p style="margin: 0px;"&gt;{&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: green;"&gt;// decrypt the password and get a reference to it...&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: teal;"&gt;IntPtr&lt;/span&gt; bstr = &lt;span style="color: teal;"&gt;Marshal&lt;/span&gt;.SecureStringToBSTR(password);&lt;/p&gt; &lt;p style="margin: 0px;"&gt; &lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    {&lt;/p&gt; &lt;p style="margin: 0px;"&gt;        &lt;span style="color: green;"&gt;// Printing the decrypted password...&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;        &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: teal;"&gt;Marshal&lt;/span&gt;.PtrToStringBSTR(bstr));&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    }&lt;/p&gt; &lt;p style="margin: 0px;"&gt; &lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;finally&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    {&lt;/p&gt; &lt;p style="margin: 0px;"&gt;        &lt;span style="color: teal;"&gt;Marshal&lt;/span&gt;.ZeroFreeBSTR(bstr);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    }&lt;/p&gt; &lt;p style="margin: 0px;"&gt;}&lt;/p&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-7099853560280600266?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/7099853560280600266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=7099853560280600266' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/7099853560280600266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/7099853560280600266'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/use-secured-secured-string-for-password.html' title='Use Secured Secured String for password'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-1140737695790409954</id><published>2008-09-11T23:56:00.000-07:00</published><updated>2008-09-12T02:34:12.924-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ado.net'/><title type='text'>How to: Retrieve database schema information using ADO.NET </title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CBhaskars%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} h3 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	mso-outline-level:3; 	font-size:13.5pt; 	font-family:"Times New Roman"; 	font-weight:bold;} a:link, span.MsoHyperlink 	{color:blue; 	text-decoration:underline; 	text-underline:single;} a:visited, span.MsoHyperlinkFollowed 	{color:purple; 	text-decoration:underline; 	text-underline:single;} p 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;h3&gt;&lt;a href="http://dotnetfacts.blogspot.com/2008/05/how-to-retrieve-database-schema.html"&gt;How to: Retrieve database schema information using ADO.NET&lt;/a&gt; &lt;/h3&gt;  &lt;p class="MsoNormal"&gt;Sometimes we need to know what is the internal structure of a database in addition to its data. This might turn very useful when the database structure is dynamic. This information is called &lt;strong&gt;Database Metadata&lt;/strong&gt; or &lt;strong&gt;Database Schema&lt;/strong&gt;. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;h3&gt;Using OleDbConnection.GetOleDbSchemaTable method&lt;/h3&gt;  &lt;p class="MsoNormal"&gt;The &lt;strong&gt;OleDbConnection&lt;/strong&gt; class provides a special method for doing this. It is called &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection.getoledbschematable.aspx"&gt;GetOleDbSchemaTable&lt;/a&gt; and returns a &lt;strong&gt;DataTable&lt;/strong&gt; that is populated with the schema information.&lt;br /&gt;&lt;br /&gt;Here is an example of how this method can be used:&lt;br /&gt;&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;DataTable&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; tblDbSchema = oleDb.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;null&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;This method accepts two parameters: &lt;/p&gt;  &lt;p class="MsoNormal"&gt;The first one is an enumeration value that specifies what kind of information to be contained by the schema output, such as tables, columns, procedures, indexes and keys. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;The second parameter is a restriction array. You can use this array to filter the schema table’s content. First array item will be used against the first column in the schema table; the second array item will be used against the second column in the schema table, and so on. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;Here is an example of how to retrieve the column schema from the "Customer" table using an &lt;strong&gt;Access database&lt;/strong&gt;. Because each value in the Object array corresponds to a &lt;strong&gt;DataColumn&lt;/strong&gt; in the resulting &lt;strong&gt;DataTable&lt;/strong&gt;, the Restrictions array should have the following structure:&lt;br /&gt;&lt;br /&gt;{TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE}&lt;br /&gt;&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; connectionString = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: maroon;"&gt;"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DatabaseFile.mdb"&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;OleDbConnection&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; oleDb = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;OleDbConnection&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;(connectionString);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;oleDb.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;object&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;[] arrRestrict;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;arrRestrict = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;object&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;[] { &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;null&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;, &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;null&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;, &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: maroon;"&gt;"Customers"&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;, &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;null&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;DataTable&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; tblDbSchema = oleDb.GetOleDbSchemaTable(&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;OleDbSchemaGuid&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;.Columns, arrRestrict);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getschematable.aspx"&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;oleDb.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;h3&gt;Using the SqlDataReader.GetSchemaTable method&lt;/h3&gt;  &lt;p class="MsoNormal"&gt;The &lt;strong&gt;SqlDataReader&lt;/strong&gt; class provide a special method for this called &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getschematable.aspx"&gt;GetSchemaTable&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; strQuery = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: maroon;"&gt;"SELECT * FROM Employees"&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; strConn = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: maroon;"&gt;"user id=sa;password=foo;initial catalog=northwind;data source=localhost;"&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlConnection&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; conn = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlConnection&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;(strConn);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlCommand&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; cmd = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlCommand&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;(strQuery, conn);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;conn.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlDataReader&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; rdr = cmd.ExecuteReader(&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;CommandBehavior&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;.CloseConnection);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;// Get the schema table.&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;DataTable&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; tblSchema = rdr.GetSchemaTable();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;conn.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;rdr.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;Each row in the returned table represent each data field in the database table. And each column has predefined name corresponding to different attribute of the fields. For a complete list of these column names and their usage, please read the &lt;a href="http://dotnetfacts.blogspot.com/2008/05/complete%20list%20of%20these%20column%20names%20and%20their%20usage."&gt;documentation&lt;/a&gt;. &lt;/p&gt;  &lt;h3&gt;Using a SQL query for SQL Server databases&lt;/h3&gt;  &lt;p class="MsoNormal"&gt;Another way to get the schema for a &lt;strong&gt;SQL Server database&lt;/strong&gt; is to execute a SQL query like in the following example:&lt;br /&gt;&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; strConn = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: maroon;"&gt;"user id=sa;password=foo;initial catalog=northwind;data source=localhost;"&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlConnection&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; conn = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlConnection&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;(strConn);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlDataAdapter&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; da = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;SqlDataAdapter&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;(&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: maroon;"&gt;"SELECT * FROM Information_Schema.Tables where Table_Type = 'BASE TABLE'"&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;, conn);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;DataTable&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; dt = &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;"&gt;DataTable&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: black;"&gt;da.Fill(dt);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-1140737695790409954?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/1140737695790409954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=1140737695790409954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/1140737695790409954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/1140737695790409954'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/how-to-retrieve-database-schema_11.html' title='How to: Retrieve database schema information using ADO.NET '/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866059043129217594.post-4207230972398181520</id><published>2008-09-11T22:01:00.000-07:00</published><updated>2008-09-12T02:35:08.734-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GarbageCollection'/><title type='text'>Implementing Garbage Collector</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CBhaskars%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"&gt;&lt;/o:smarttagtype&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if !mso]&gt;&lt;object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id="ieooui"&gt;&lt;/object&gt; &lt;style&gt; st1\:*{behavior:url(#ieooui) } &lt;/style&gt; &lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Wingdings; 	panose-1:5 0 0 0 0 0 0 0 0 0; 	mso-font-charset:2; 	mso-generic-font-family:auto; 	mso-font-pitch:variable; 	mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} h3 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	mso-outline-level:3; 	font-size:13.5pt; 	font-family:"Times New Roman"; 	font-weight:bold;} a:link, span.MsoHyperlink 	{color:blue; 	text-decoration:underline; 	text-underline:single;} a:visited, span.MsoHyperlinkFollowed 	{color:purple; 	text-decoration:underline; 	text-underline:single;} p 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} pre 	{margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; 	font-size:10.0pt; 	font-family:"Courier New"; 	mso-fareast-font-family:"Times New Roman";} span.EmailStyle16 	{mso-style-type:personal; 	mso-style-noshow:yes; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:Arial; 	mso-ascii-font-family:Arial; 	mso-hansi-font-family:Arial; 	mso-bidi-font-family:Arial; 	color:windowtext;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:843402386; 	mso-list-template-ids:-1708080730;} @list l0:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l1 	{mso-list-id:1314025636; 	mso-list-template-ids:501797972;} @list l1:level1 	{mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l2 	{mso-list-id:1408990858; 	mso-list-template-ids:-2003646712;} @list l2:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l3 	{mso-list-id:1930189904; 	mso-list-template-ids:1503711448;} @list l3:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l4 	{mso-list-id:2026512205; 	mso-list-template-ids:93372984;} @list l4:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;h3&gt;The &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;Garbage Collector (GC)&lt;/span&gt;&lt;/strong&gt; can be considered the heart of the &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;.NET Framework&lt;/span&gt;&lt;/strong&gt;. It manages the allocation and release of memory automatically for any &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;.NET&lt;/span&gt;&lt;/strong&gt; application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;h3&gt;Basic rules&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;The &lt;strong&gt;Garbage Collector      (GC)&lt;/strong&gt; can’t be controlled by the application. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;All garbage-collectable      objects are allocated from one &lt;strong&gt;contiguous range&lt;/strong&gt; of      address space and are grouped by age. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;There are never any gaps      between objects in the &lt;strong&gt;managed heap&lt;/strong&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;The order of objects in      memory remains the order in which they were created. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;The oldest objects are at the      lowest addresses (&lt;strong&gt;managed heap&lt;/strong&gt; bottom), while new objects      are created at increasing addresses (&lt;strong&gt;managed heap&lt;/strong&gt; top). &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Periodically the &lt;strong&gt;managed      heap&lt;/strong&gt; is compacted by removing dead objects and sliding the live      objects up toward the low-address end of the heap. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;h3&gt;The GC generations&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;h3&gt;All the living objects from the managed heap are divided in three groups by their age. Those groups are generically called &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;"Generations"&lt;/span&gt;&lt;/strong&gt;. Those generations are very useful to &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;prevent memory fragmentation&lt;/span&gt;&lt;/strong&gt; on the &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;managed heap&lt;/span&gt;&lt;/strong&gt;. The &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;Garbage Collector (GC)&lt;/span&gt;&lt;/strong&gt; can search for dead object on each generation at a time (&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;partial collections&lt;/span&gt;&lt;/strong&gt;), to improve the collecting performance.&lt;br /&gt;&lt;br /&gt;Now let’s see what the &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;Garbage Collector (GC)&lt;/span&gt;&lt;/strong&gt; is using each generation for:&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/h3&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;Generation 0 (Gen0)&lt;/strong&gt;      contains all the newly created objects and it is located on the top of the      heap zone (higher memory addresses). All the objects contained by Gen0 are      considered &lt;strong&gt;short-lived&lt;/strong&gt; object and the &lt;strong&gt;Garbage      Collector (GC)&lt;/strong&gt; is expecting to them to be quickly destroyed in order      to release the used memory space. Due to this presumption, the &lt;strong&gt;Garbage      Collector (GC)&lt;/strong&gt; will try to collect dead objects most often from      Gen0 because it is &lt;strong&gt;cheapest&lt;/strong&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;Generation 1 (Gen1)&lt;/strong&gt;      contains all the living objects from Gen0 that have survived to several      Gen0 collects. So those objects are upgraded from Generation 0 to      Generation 1. Gen1 is defined in the middle of the heap zone and it is      exposed to fewer garbage collects than Gen0. Gen1’s collects are more      expensive than the Gen0’s so the &lt;strong&gt;Garbage Collector (GC)&lt;/strong&gt;      will try to avoid them if it is not really necessary. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;Generation 2 (Gen2)&lt;/strong&gt;      contains all the living objects from Gen1 that have survived to several      Gen2 collects. Those objects are considered &lt;strong&gt;long-lived&lt;/strong&gt;      objects and destroying them is very expensive. Because of this, the &lt;strong&gt;Garbage      Collector (GC)&lt;/strong&gt; will hardly try to collect them. The Gen2 zone is      located on the bottom of the &lt;strong&gt;managed heap&lt;/strong&gt; zone (&lt;strong&gt;lowest      memory addresses&lt;/strong&gt;). &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;h3&gt;Collecting the Garbage&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;p class="MsoNormal" style=""&gt;The &lt;strong&gt;GC&lt;/strong&gt; is able to collect the garbage in two ways: &lt;strong&gt;full collections&lt;/strong&gt; (searching the entire managed heap for dead objects) and &lt;strong&gt;partial collections&lt;/strong&gt; (searching only a single generation zone).&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;When the &lt;strong&gt;GS&lt;/strong&gt; starts collecting the garbage, performing a full or partial collection, the first thing it does is to &lt;strong&gt;stop the application execution&lt;/strong&gt;. So, at least from this point of view, collecting dead objects is an &lt;strong&gt;expensive task&lt;/strong&gt;! For a full collection, the application can be stopped for a very long time!&lt;br /&gt;&lt;br /&gt;The second step is to identify the &lt;strong&gt;root objects&lt;/strong&gt;. A root object is an object having no references from other objects. For example the &lt;strong&gt;global members&lt;/strong&gt; of an application are suitable to be &lt;strong&gt;root objects&lt;/strong&gt;. Starting with these &lt;strong&gt;roots&lt;/strong&gt;, the &lt;strong&gt;GC&lt;/strong&gt; follows each reference contained by them &lt;strong&gt;inspecting recursively&lt;/strong&gt; all the child objects. In this way the &lt;strong&gt;GC&lt;/strong&gt; will have found every &lt;strong&gt;reachable&lt;/strong&gt; or live object. The other objects, the &lt;strong&gt;unreachable&lt;/strong&gt; ones, are now condemned to be collected.&lt;br /&gt;&lt;br /&gt;If a partial collection is performed, the &lt;strong&gt;GC&lt;/strong&gt; will iterate only thru objects having &lt;strong&gt;same age or younger&lt;/strong&gt;. For example, a &lt;strong&gt;Gen1&lt;/strong&gt; root may have child objects from &lt;strong&gt;Gen1&lt;/strong&gt; or &lt;strong&gt;Gen0&lt;/strong&gt;. Considering this, inspecting &lt;strong&gt;Gen2&lt;/strong&gt; roots is equivalent to perform a full collection, which is &lt;strong&gt;very expensive&lt;/strong&gt;, because &lt;strong&gt;Gen2&lt;/strong&gt; objects may have references to children from &lt;strong&gt;Gen1&lt;/strong&gt; and &lt;strong&gt;Gen0&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;All the live objects have been found will have their age incremented and be &lt;strong&gt;upgraded to the next generation&lt;/strong&gt;, if necessary. Upgrading an object to the next generation involves moving its data on a different memory location of the managed heap. In order to not &lt;strong&gt;affect the performance&lt;/strong&gt; too much, an object must have been survived more than one collection on its current generation to be upgraded on the next one.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;h3&gt;Things you MUST dispose&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;p class="MsoNormal"&gt;When the &lt;strong&gt;.NET Framework&lt;/strong&gt; instantiates an object, it allocates memory for that object on the &lt;strong&gt;managed heap&lt;/strong&gt;. The object remains on the heap until it's no longer referenced by any active code, at which point the memory it's using is reclaimed by the &lt;strong&gt;Garbage Collector&lt;/strong&gt; (GC). Before the GC deallocates the memory, the framework calls the object's Finalize() method, but &lt;strong&gt;developers are responsible&lt;/strong&gt; for calling the Dispose() method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;h3&gt;Dispose GUI elements&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;Dialog forms&lt;/strong&gt;.      In &lt;strong&gt;.NET&lt;/strong&gt;, a dialog form is a form opened by calling the &lt;a href="http://msdn2.microsoft.com/en-us/library/c7ykbedk.aspx"&gt;ShowDialog()&lt;/a&gt;      method. Unlike &lt;strong&gt;modeless forms&lt;/strong&gt;, the &lt;strong&gt;Close&lt;/strong&gt;      method is not called by the &lt;strong&gt;.NET Framework&lt;/strong&gt; when the user      clicks the close form button of a dialog box or sets the value of the &lt;strong&gt;DialogResult&lt;/strong&gt;      property. Instead the form is &lt;strong&gt;hidden&lt;/strong&gt; and can be shown      again without creating a new instance of the dialog box. Because a form      displayed as a dialog box is not closed, you must call the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.idisposable.dispose%28VS.71%29.aspx"&gt;Dispose()&lt;/a&gt;      method of the form when the form is no longer needed by your application. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;GDI+ resources&lt;/strong&gt;.      The GDI+ resources, like: pens, brushes and fonts, need to be disposed      because they encapsulate GDI+ handles in them and GDI+ is build in C++      (unmanaged code). To release the GDI+ resources, we must call the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.idisposable.dispose%28VS.71%29.aspx"&gt;Dispose()&lt;/a&gt;      method for each of them.&lt;br /&gt;  &lt;br /&gt;    The proper usage is to create, use and dispose of an item in the right      place. For example:&lt;br /&gt;           &lt;!--[if !supportLineBreakNewLine]--&gt;       &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p style="margin: 0in 0in 0.0001pt 0.5in; background: whitesmoke none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:blue;"   &gt;void&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:blue;"   &gt;override&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt; OnPaint(&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:teal;"   &gt;PaintEventArgs&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt; e) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0.0001pt 0.5in; background: whitesmoke none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;{ &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0.0001pt 0.5in; background: whitesmoke none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:teal;"   &gt;Pen&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt; p = &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:blue;"   &gt;new&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:teal;"   &gt;Pen&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;(&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:teal;"   &gt;Color&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;.Blue, 1); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:green;"   &gt;// create &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0.0001pt 0.5in; background: whitesmoke none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;    e.Graphics.DrawLine(p, 0, 0, 20, 20); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:green;"   &gt;// use &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0.0001pt 0.5in; background: whitesmoke none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;    p.Dispose(); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:green;"   &gt;// dispose &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0.0001pt 0.5in; background: whitesmoke none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;br /&gt;&lt;strong&gt;Don't&lt;/strong&gt; use GDI+ resources like this:&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;  &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0.0001pt 0.5in; background: whitesmoke none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;g.DrawLine(&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:blue;"   &gt;new&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:teal;"   &gt;Pen&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;(&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:teal;"   &gt;Color&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:9;color:black;"   &gt;.Blue, 1), 0, 0, 20, 20);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;br /&gt;The Pen object in this case is created inline and never disposed of. However, when using one of the &lt;strong&gt;ready-made&lt;/strong&gt; pens from Pens or SystemPens, you must &lt;strong&gt;never dispose&lt;/strong&gt; the object! This is also true for ready-made brushes.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://msdn2.microsoft.com/en-us/library/system.drawing.graphics.aspx"&gt;Graphics&lt;/a&gt; object, if is returned by &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.creategraphics.aspx"&gt;Control.CreateGraphics()&lt;/a&gt; method, must be also disposed as soon as it is not needed anymore. If the Graphics object is accessed thru &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.painteventargs.aspx"&gt;PaintEventArgs&lt;/a&gt; you don't have to call &lt;a href="http://msdn2.microsoft.com/en-us/library/system.idisposable.dispose%28VS.71%29.aspx"&gt;Dispose()&lt;/a&gt; because .NET will handle that for you. You can read more about GDI+ in this article: &lt;a href="http://dotnetfacts.blogspot.com/2008/04/gdi-windows-rendering-api.html"&gt;GDI+ Windows rendering API&lt;/a&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;h3&gt;Dispose data sources&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;Database connections.&lt;/strong&gt;      Dispose any database connection you don't need anymore to ensure no      resources are being held by it. Also, the Dispose method of a connection      object &lt;strong&gt;automatically calls its Close method&lt;/strong&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;strong&gt;Stream objects.&lt;/strong&gt;      This includes &lt;strong&gt;files&lt;/strong&gt; and &lt;strong&gt;memory streams&lt;/strong&gt;,      anything inheriting from the Stream class. Calling Dispose allows the      resources used by the &lt;strong&gt;stream&lt;/strong&gt; to be reallocated for other      purposes. Before releasing all the resources, this method disposes the      stream, by &lt;strong&gt;writing&lt;/strong&gt; any changes to the backing store and &lt;strong&gt;closing&lt;/strong&gt;      the stream. &lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;span style=";font-family:Arial;font-size:13;"  &gt;C# Tip: Forcing Garbage Collection in .NET&lt;/span&gt;&lt;/b&gt;  &lt;!--[if !supportLineBreakNewLine]--&gt;  &lt;!--[endif]--&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;There might be times in your application when you want to force the .NET Garbage Collector (GC) to spin through all unused objects and de-allocate them. The method for accomplishing this task is the &lt;b&gt;GC.Collect&lt;/b&gt; method. When you call &lt;b&gt;GC.Collect&lt;/b&gt;, the GC will run each object's finalizer on a separate thread. Therefore, another method to keep in mind is &lt;b&gt;GC.WaitForPendingFinalizers&lt;/b&gt;. This synchronous method that will not return until the &lt;b&gt;GC.Collect&lt;/b&gt; has finished its work.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;Here's a simple example of using these two methods:&lt;/span&gt;&lt;/p&gt;  &lt;pre&gt;&lt;span style=";font-family:Verdana;color:blue;"  &gt;using&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=";font-family:Verdana;color:blue;"  &gt;namespace&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt; GCCollect&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;class&lt;/span&gt; Account&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; Account(&lt;span style="color:blue;"&gt;string&lt;/span&gt; accountNumber)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;.accountNumber = accountNumber; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;Console.WriteLine("Account::Acount - c'tor");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;~Account() &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;Console.WriteLine("Account::~Acount - d'tor");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected string&lt;/span&gt; accountNumber;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;override public string&lt;/span&gt; ToString() { &lt;span style="color:blue;"&gt;return&lt;/span&gt; accountNumber; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;class&lt;/span&gt; Class1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;[STAThread]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;static void&lt;/span&gt; &lt;st1:place st="on"&gt;Main&lt;/st1:place&gt;(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;CreateAccount("111006116");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;b&gt;GC.Collect();&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;GC.WaitForPendingFinalizers();&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;Console.WriteLine("Application ending");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public static void&lt;/span&gt; CreateAccount(&lt;span style="color:blue;"&gt;string&lt;/span&gt; accountNumber)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style=""&gt;    &lt;/span&gt;Console.WriteLine("CreateAccount - instantiate Account object");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;Account account = &lt;span style="color:blue;"&gt;new&lt;/span&gt; Account(accountNumber);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;Console.WriteLine("CreateAccount - created account number {0}",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;                        &lt;/span&gt;account);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;If you build and run this example, you will receive the following output:&lt;/span&gt;&lt;/p&gt;  &lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;CreateAccount - instantiate Account object&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;Account::Acount - c'tor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;CreateAccount - created account number 111006116&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;Account::~Acount - d'tor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:Verdana;"&gt;Application ending&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;Note a couple of issues here:&lt;/span&gt;&lt;/p&gt;  &lt;ol start="1" type="1"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;I allocated the &lt;b&gt;Account&lt;/b&gt; object in a different      method than the &lt;b&gt;Main&lt;/b&gt; method. This is because if I allocated the &lt;b&gt;Account&lt;/b&gt;      object in the &lt;b&gt;Main&lt;/b&gt; method and then called &lt;b&gt;GC.Collect&lt;/b&gt; in the      same method, the &lt;b&gt;Account&lt;/b&gt; object would technically still be      associated with running code and would therefore not be eligible for      collection.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;While I used a simple single object example here to      illustrate calling the &lt;b&gt;GC.Collect&lt;/b&gt; method, the &lt;b&gt;GC.Collect method&lt;/b&gt;      is designed not to control specific object destruction, but to allow for      the forcing of collection for all of unused objects. Therefore, it's a      very expensive operation and should only be used in cases where you      want/need to force global collection.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;For situations where you want to force the      finalization of a specific object, you should implement the Dispose      pattern, which I'll cover in a separate article.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866059043129217594-4207230972398181520?l=edgingdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edgingdotnet.blogspot.com/feeds/4207230972398181520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866059043129217594&amp;postID=4207230972398181520' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/4207230972398181520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866059043129217594/posts/default/4207230972398181520'/><link rel='alternate' type='text/html' href='http://edgingdotnet.blogspot.com/2008/09/implementing-garbage-collector.html' title='Implementing Garbage Collector'/><author><name>bhas</name><uri>http://www.blogger.com/profile/04085279176173575254</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
