Analytics

Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

2. What is Manifest?

Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things. Version of assembly. Security identity. Scope of the assembly. Resolve references to resources and classes.The assembly manifest can be stored in a PE file either (an .exe or) .dll with Microsoft intermediate language (MSIL code with Microsoft intermediate language (MSIL) code or in astand-alone PE file, that contains only assembly manifest information.

3. What are code contracts?

Code contracts help you to express the code assumptions and statements stating the behavior of your code in a language-neutral way. The contracts are included in the form of pre-conditions, post-conditions and object-invariants. The contracts help you to improve-testing by enabling run-time checking, static contract verification, and documentation generation.The System.Diagnostics.Contracts namespace contains static classes that are used to express contracts in your code.

4. Name the classes that are introduced in the System.Numerics namespace.

The following two new classes are introduced in the System.Numerics namespace:BigInteger - Refers to a non-primitive integral type, which is used to hold a value of any size. It has no lower and upper limit, making it possible for you to perform arithmetic calculations with very large numbers, even with the numbers which cannot hold by double or long.Complex - Represents complex numbers and enables different arithmetic operations with complex numbers. A number represented in the form a + bi, where a is the real part, and b is the imaginary part, is a complex number.

5. What is managed extensibility framework?

Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement.

6. Explain memory-mapped files.

Memory-mapped files (MMFs) allow you map the content of a file to the logical address of an application. These files enable the multiple processes running on the same machine to share data with each Other. The MemoryMappedFile.CreateFromFile() method is used to obtain a MemoryMappedFile object that represents a persisted memory-mapped file from a file on disk.These files are included in the System.IO.MemoryMappedFiles namespace. This namespace contains four classes and three enumerations to help you access and secure your file mappings.

7. What is Common Type System (CTS)?

CTS is the component of CLR through which .NET Framework provides support for multiple languages because it contains a type system that is common across all the languages. Two CTS-compliant languages do not require type conversion when calling the code written in one language from within the code written in another language. CTS provide a base set of data types for all the languages supported by.NET Framework. This means that the size of integer and long variables is same across all .NET-compliant programming languages. However, each language uses aliases for the base data types provided by CTS. For example, CTS uses the data type system. int32 to represent a 4 byte integer value; however, Visual Basic uses the alias integer for the same; whereas, C# uses the alias int. This is done for the sake of clarity and simplicity.

8. Give a brief introduction on side-by-side execution. Can two applications, one using private assembly and the other using the shared assembly be stated as side-by-side executables?

Side-by-side execution enables you to run multiple versions of an application or component and CLR on the same computer at the same time. As versioning is applicable only to shared assemblies and not to private assemblies, two applications, one using a private assembly and other using a shared assembly, cannot be stated as side-by-side executables.

9.What is a IL or What is MSIL or CIL , What is JIT?

(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In- Time (JIT) compiler.

10.What is a CLR?

Full form of CLR is Common Language Runtime and it forms the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example VC++ has MSCRT40.DLL,VB6 has MSVBVM60.DLL, Java has Java Virtual Machine etc. Similarly .NET has CLR. Following are the responsibilities of CLR:-1. Garbage Collection - CLR automatically manages memory thus eliminating memory leaks. When objects are not referred GC automatically releases those memories thus providing efficient memory management.2. Code Access Security - CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.3. Code Verification - This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.IL( Intermediate language )-to-native translators and optimizer’s - CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.

11.What is a CTS?

In order that two language communicate smoothly CLR has CTS (Common Type System). Example in VB you have "Integer" and in C++ you have "long" these datatypes are not compatible so the interfacing between them is very complicated. In order to able that two different languages can communicate Microsoft introduced Common Type System. So "Integer" datatype in VB6 and "int" datatype in C++ will convert it to System.int32 which is datatype of CTS. CLS which is covered in the coming question is subset of CTS. Note: If you have undergone COM programming period interfacing VB6 application with VC++ application was a real pain as the datatype of both languages did not have a common ground where they can come and interface, by having CTS interfacing is smooth.

12.What is a CLS(Common Language Specification)?

This is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.

13.What is a Managed Code?

Managed code runs inside the environment of CLR i.e. .NET runtime. In short all IL are managed code. But if you are using some third party software example VB6 or VC++ component they are unmanaged code as .NET runtime (CLR) does not have control over the source code execution of the language.

14.What is a Assembly?

1. Assembly is unit of deployment like EXE or a DLL.2. An assembly consists of one or more files (dlls, exe’s, html files etc.), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing.3. An assembly is completely self-describing.An assembly contains metadata information, which is used by the CLR for everything from type checking and security to actually invoking the components methods. As all information is in the assembly itself, it is independent of registry. This is the basic advantage as compared to COM where the version was stored in registry.4. Multiple versions can be deployed side by side in different folders. These different versions can execute at the same time without interfering with each other. Assemblies can be private or shared. For private assembly deployment, the assembly is copied to the same directory as the client program that references it. No registration is needed, and no fancy installation program is required. When the component is removed, no registry cleanup is needed, and no uninstall program is required. Just delete it from the hard drive.5. In shared assembly deployment, an assembly is installed in the Global Assembly Cache (or GAC). The GAC contains shared assemblies that are globally accessible to all .NET applications on the machine.

15.What are the different types of Assembly?

There are two types of assembly Private and Public assembly. A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. Crystal report classes which will be used by all application for Reports.

16.What is NameSpace?

Namespace has two basic functionality :-1. NameSpace Logically group types, example System.Web.UI logically groups our UI related features.2. In Object Oriented world many times its possible that programmers will use the same class name.By qualifying NameSpace with classname this collision is able to be removed.

Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things:- 1. Version of assembly. 2. Security identity. 3. Scope of the assembly. 4. Resolve references to resources and classes. 5. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a stand-alone PE file that contains only assembly manifest information.

19.Where is version information stored of an assembly?

Version information is stored in assembly in manifest.

20.Is versioning applicable to private assemblies?

Versioning concept is only applicable to global assembly cache (GAC) as private assembly lie in their individual folders.

21.What is GAC?

GAC (Global Assembly Cache) is used where shared .NET assembly reside. GAC is used in the following situations :-1. If the application has to be shared among several application.2. If the assembly has some special security requirements like only administrators can remove the assembly. If the assembly is private then a simple delete of assembly the assembly file will remove the assembly.

22.What is the concept of strong names?

Strong name is similar to GUID(It is supposed to be unique in space and time) in COM components.Strong Name is only needed when we need to deploy assembly in GAC. Strong Names helps GAC to differentiate between two versions. Strong names use public key cryptography (PKC) to ensure that no one can spoof it.PKC use public key and private key concept.

23.How to add and remove an assembly from GAC?

There are two ways to install .NET assembly in GAC:-1. Using Microsoft Installer Package. You can get download of installer from http://www.microsoft.com.2. Using Gacutil. Goto "Visual Studio Command Prompt" and type "gacutil –i (assembly_name)", where (assembly_name) is the DLL name of the project.

24.What is garbage collection?

Garbage collection is a CLR feature which automatically manages memory. Programmers forget to release the objects while coding.(Remember in VB6 where one of the good practices is to set object to nothing). CLR automatically releases objects when they are no longer in use and refernced. CLR runs on non-deterministic to see the unused objects and cleans them. One side effect of this non-deterministic feature is that we cannot assume an object is destroyed when it goes out of the scope of a function. Therefore, we should not put code into a class destructor to release resources.

25.Can we force garbage collector to run?

System.GC.Collect() forces garbage collector to run. This is not recommended but can be used if situations arises.

26.What is reflection?

All .NET assemblies have metadata information stored about the types defined in modules. This metadata information can be accessed by mechanism called as "Reflection".System. Reflection can be used to browse through the metadata information.

27.What are Value types and Reference types?

Value types directly contain their data which are either allocated on the stack or allocated in-line in a structure. Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. Variables that are value types each have their own copy of the data, and therefore operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable. All types derive from the System.Object base type.

28.What is concept of Boxing and Unboxing?

Boxing permits any value type to be implicitly converted to type object or to any interface type implemented by value type. Boxing is a process in which object instances are created and copy values in to that instance. Unboxing is vice versa of boxing operation where the value is copied from the instance in to appropriate storage location. Below is sample code of boxing and unboxing where integer data type is converted in to object and then vice versa.Dim x As IntegerDim y As Objectx =10y = x ‘ boxing processx = y ‘ unboxing process

29.What is the difference between VB.NET and C#?

Well this is the most debatable issue in .NET community and people treat there languages like religion. Its a subjective matter which language is best. Some like VB.NET’s natural style and some like professional and terse C# syntaxes. Both use the same framework and speed is also very much equivalents. But still let’s list down some major differences between them :- Advantages VB.NET :- 1. Has support for optional parameters which makes COM interoperability much easy. 2. With Option Strict off late binding is supported.Legacy VB functionalities can be used by using Microsoft.VisualBasic namespace. 3. Has the WITH construct which is not in C#. 4. The VB.NET part of Visual Studio .NET compiles your code in the background. While this is considered an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.Advantages of C# 1. XML documentation is generated from source code but this is now been incorporated in Whidbey. 2. Operator overloading which is not in current VB.NET. 3. Use of this statement makes unmanaged resource disposal simple. 4. Access to Unsafe code. This allows pointer arithmetic etc, and can improve performance in some situations. However, it is not to be used lightly, as a lot of the normal safety of C# is lost (as the name implies).This is the major difference that you can access unmanaged code in C# and not in VB.NET.

30.What is CODE Access security?

CAS is part of .NET security model that determines whether or not a piece of code is allowed to run and what resources it can use while running. Example CAS will allow an application to read but not to write and delete a file or a resource from a folder..

31.How to prevent my .NET DLL to be decompiled?

By design .NET embeds rich Meta data inside the executable code using MSIL. Any one can easily decompile your DLL back using tools like ILDASM (owned by Microsoft) or Reflector for .NET which is a third party. Secondly there are many third party tools which make this decompiling process a click away. So any one can easily look in to your assemblies and reverse engineer them back in to actual source code and understand some real good logic which can make it easy to crack your application. The process by which you can stop this reverse engineering is using "obfuscation". It’s a technique which will foil the decompilers. There are many third parties (XenoCode, Demeanor for .NET) which provide .NET obfuscation solution. Microsoft includes one that is Dotfuscator Community Edition with Visual Studio.NET.

32.How ASP .NET different from ASP?

Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.

33.What is smart navigation?

The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

34.What is view state?

The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control

35.How do you validate the controls in an ASP .NET page?

Using special validation controls that are meant for this. We have Range Validator, Email Validator.

36.Can the validation be done in the server side? Or this can be done only in the Client side?

Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.

37.How to manage pagination in a page?

Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.

38.What’ is the sequence in which ASP.NET events are processed?

Following is the sequence in which the events occur :-1. Page_Init.2. Page_Load.3. Control events4. Page_Unload event.Page_init event only occurs when first time the page is started, but Page_Load occurs in subsequent request of the page.

39.What is an application object?

Application object ca be n used in situation where we want data to be shared across users globally.

40.What’s the difference between Cache object and application object?

The main difference between the Cache and Application objects is that the Cache object provides cache-specific features, such as dependencies and expiration policies.

41.How can get access to cache object?

The Cache object is defined in the System.Web.Caching namespace. You can get a reference to the Cache object by using the Cache property of the HttpContext class in the System.Web namespace or by using the Cache property of the Page object.

42.What are dependencies in cache and types of dependencies?

When you add an item to the cache, you can define dependency relationships that can force that item to be removed from the cache under specific activities of dependenci es.Example if the cache object is dependent on file and when the file data changes you want the cache object to be update. Following are the supported dependency :-

1. File dependency :- Allows you to invalidate a specific cache item when a disk based file or files change. 2. Time-based expiration :- Allows you to invalidate a specific cache item depending on predefined time. 3. Key dependency :-Allows you to invalidate a specific cache item depending when another cached item changes.

43.What is Cache Callback in Cache?

Cache object is dependent on its dependencies example file based, time based etc...Cache items remove the object when cache dependencies change.ASP.NET provides capability to execute a callback method when that item is removed from cache.

44.What is scavenging?

When server running your ASP.NET application runs low on memory resources, items are removed from cache depending on cache item priority. Cache item priority is set when you add item to cache. By setting the cache item priority controls the items scavenging are removed first.

45.What are different types of caching using cache object of ASP.NET?

You can use two types of output caching to cache information that is to be transmitted to and displayed in a Web browser: v Page Output Caching Page output caching adds the response of page to cache object. Later when page is requested page is displayed from cache rather than creating the page object and displaying it. Page output caching is good if the site is fairly static. v Page Fragment Caching If parts of the page are changing, you can wrap the static sections as user controls and cache the user controls using page fragment caching.

46.How can you cache different version of same page using ASP.NET cache object ?

Output cache functionality is achieved by using "OutputCache" attribute on ASP.NET page header. Below is the syntax v VaryByParam :- Caches different version depending on input parameters send through HTTP POST/GET. v VaryByHeader:- Caches different version depending on the contents of the page header. 181 v VaryByCustom:-Lets you customize the way the cache handles page variations by declaring the attribute and overriding the GetVaryByCustomString handler. v VaryByControl:-Caches different versions of a user control based on the value of properties of ASP objects in the control.

1. ASP session state is dependent on IIS process very heavily. So if IIS restarts ASP session variables are also recycled.ASP.NET session can be independent of the hosting environment thus ASP.NET session can maintained even if IIS reboots.2. ASP session state has no inherent solution to work with Web Farms.ASP.NET session can be stored in state server and SQL SERVER which can support multiple server.3. ASP session only functions when browser supports cookies.ASP.NET session can be used with browser side cookies or independent of it.

48.Which various modes of storing ASP.NET session?

1. InProc:- In this mode Session state is stored in the memory space of the Aspnet_wp.exe process. This is the default setting. If the IIS reboots or web application restarts then session state is lost.2. StateServer:-In this mode Session state is serialized and stored in a separate process (Aspnet_state.exe); therefore, the state can be stored on a separate computer(a state server).3. SQL SERVER:- In this mode Session state is serialized and stored in a SQL Server database.

Session state can be specified in "sessionstate" element of application configuration file. Using State Server and SQL SERVER session state can be shared across web farms but note this comes at speed cost as ASP.NET needs to serialize and deserialize data over network again and again.

49.Is Session_End event supported in all session modes?

Session_End event occurs only in "Inproc mode"."State Server" and "SQL SERVER" do not have Session_End event.

50.What are the precautions you will take in order that StateServer Mode work properly ?

Following are the things to remember so that StateServer Mode works properly :-1. StateServer mode session data is stored in a different process so you must ensure that your objects are serializable.2. elements in Web.config should be identical across all servers.So this ensures that encryption format is same across all computers.3. IIS metabase (\LM\W3SVC\2) must be identical across all servers in that farm.

51.What are the precautions you will take in order that SQLSERVER Mode work properly ?

Following are the things to remember so that SQLSERVER Mode works properly :-1. SQLSERVER mode session data is stored in a different process so you must ensure that your objects are serializable.2. IIS metabase (\LM\W3SVC\2) must be identical across all servers in that farm.3. By default Session objects are stored in "Tempdb", you can configure it store outside "TempDB" by running Microsoft provided SQL script.

52.What is an application object?

Application object ca be n used in situation where we want data to be shared across users globally.

53.What’s the difference between Cache object and application object?

The main difference between the Cache and Application objects is that the Cache object provides cache-specific features, such as dependencies and expiration policies.

54.How can get access to cache object?

The Cache object is defined in the System.Web.Caching namespace. You can get a reference to the Cache object by using the Cache property of the HttpContext class in the System.Web namespace or by using the Cache property of the Page object.

55.What are dependencies in cache and types of dependencies?

When you add an item to the cache, you can define dependency relationships that can force that item to be removed from the cache under specific activities of dependencies.Example if the cache object is dependent on file and when the file data changes you want the cache object to be update. Following are the supported dependency :-

1. File dependency - Allows you to invalidate a specific cache item when a disk based file or files change.2. Time-based expiration - Allows you to invalidate a specific cache item depending on predefined time.3. Key dependency - Allows you to invalidate a specific cache item depending when another cached item changes.

56.What is Cache Callback in Cache?

Cache object is dependent on its dependencies example file based, time based etc. Cache items remove the object when cache dependencies change.ASP.NET provides capability to execute a callback method when that item is removed from cache.

57.What is scavenging?

When server running your ASP.NET application runs low on memory resources, items are removed from cache depending on cache item priority. Cache item priority is set when you add item to cache. By setting the cache item priority controls the items scavenging are removed first.

58.What are different types of caching using cache object of ASP.NET?

You can use two types of output caching to cache information that is to be transmitted to and displayed in a Web browser:1. Page Output Caching - Page output caching adds the response of page to cache object. Later when page is requested page is displayed from cache rather than creating the page object and displaying it. Page output caching is good if the site is fairly static.2. Page Fragment Caching - If parts of the page are changing, you can wrap the static sections as user controls and cache the user controls using page fragment caching.

59.How will implement Page Fragment Caching?

Page fragment caching involves the caching of a fragment of the page, rather than the entire page. When portions of the page are need to be dynamically created for each user request this is best method as compared to page caching. You can wrap Web Forms user control and cache the control so that these portions of the page don’t need to be recreated each time.

ASP.NET session caches per user session state. It basically uses "HttpSessionState" class. Following are the limitations in classic ASP sessions :- 1. ASP session state is dependent on IIS process very heavily. So if IIS restarts ASP session variables are also recycled.ASP.NET session can be independent of the hosting environment thus ASP.NET session can maintained even if IIS reboots. 2. ASP session state has no inherent solution to work with Web Farms.ASP.NET session can be stored in state server and SQL SERVER which can support multiple server. 3. ASP session only functions when browser supports cookies.ASP.NET session can be used with browser side cookies or independent of it.

61.Which various modes of storing ASP.NET session?

1. InProc - In this mode Session state is stored in the memory space of the Aspnet_wp.exe process. This is the default setting. If the IIS reboots or web application restarts then session state is lost.2. StateServer - In this mode Session state is serialized and stored in a separate process (Aspnet_state.exe); therefore, the state can be stored on a separate computer(a state server).3. SQL SERVER - In this mode Session state is serialized and stored in a SQL Server database. Session state can be specified in <sessionstate> element of application configuration file. Using State Server and SQL SERVER session state can be shared across web farms but note this comes at speed cost as ASP.NET needs to serialize and deserialize data over network again and again.

62.Is Session_End event supported in all session modes?

Session_End event occurs only in "Inproc mode"."State Server" and "SQL SERVER" do not have Session_End event.

63.What are the precautions you will take in order that StateServer Mode work properly ?

Following are the things to remember so that StateServer Mode works properly :-1. StateServer mode session data is stored in a different process so you must ensure that your objects are serializable.2. <machinekey> elements in Web.config should be identical across all servers.So this ensures that encryption format is same across all computers.3. IIS metabase (\LM\W3SVC\2) must be identical across all servers in that farm.

64.What is the namespace in which .NET has the data functionality classes?

Following are the namespaces provided by .NET for data management :-1. System.data - This contains the basic objects used for accessing and storing relational data, such as DataSet,DataTable, and DataRelation. Each of these is independent of the type of data source and the way we connect to it.2. System.Data.OleDB - It contains the objects that we use to connect to a data source via an OLE-DB provider, such as OleDbConnection, OleDbCommand, etc. These objects inherit from the common base classes, and so have the same properties, methods, and events as the SqlClient equivalents.3. System.Data.SqlClient - This contains the objects that we use to connect to a data source via the Tabular Data Stream (TDS) interface of Microsoft SQL Server (only). This can generally provide better performance as it removes some of the intermediate layers required by an OLE-DB connection.4. System.XML - This Contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.

65.What are the two fundamental objects in ADO.NET?

Datareader and Dataset are the two fundamental objects in ADO.NET.

66.What is difference between dataset and datareader?

Following are some major differences:-1. DataReader provides forward-only and read-only access to data, while the DataSet object can hold more than one table (in other words more than one rowset) from the same data source as well as the relationships between them.2. Dataset is a disconnected architecture while datareader is connected architecture.3. Dataset can persist contents while datareader can not persist contents, they are forward only.

67.What are major difference between classic ADO and ADO.NET?

Following are some major differences between both1. As in classic ADO we had client and server side cursors they are no more present in ADO.NET. Note it's a disconnected model so they are no more applicable.2. Locking is not supported due to disconnected model.3. All data persist in XML as compared to classic ADO where data persisted in Binary format also.

68.What is the use of connection object?

They are used to connect a data to a Command object.1. An OleDbConnection object is used with an OLE-DB provider.2. A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server

69.What is the use of command objects and what are the methods provided by the command object?

They are used to connect connection object to Datareader or dataset. Following are the methods provided by command object :-1. ExecuteNonQuery - Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE or INSERT). Returns an Integer indicating the number of rows affected by the query.2. ExecuteReader - Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting rowset within the database, allowing the rows to be retrieved.3. ExecuteScalar - Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only single value (effectively the first column of the first row of the resulting rowset) any other returned columns and rows are discarded. It is fast and efficient when only a "singleton" value is required

70.What is the use of dataadapter?

These are objects that connect one or more Command objects to a Dataset object. They provide logic that would get data from the data store and populates the tables in the DataSet, or pushes the changes in the DataSet back into the data store.1. An OleDbDataAdapter object is used with an OLE-DB provider2. A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.

71.What is Dataset object?

The DataSet provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.

72.What are the various objects in Dataset?

Dataset has a collection of DataTable object within the Tables collection. Each DataTable object contains a collection of DataRow objects and a collection of DataColumn objects. There are also collections for the primary keys, constraints, and default values used in this table which is called as constraint collection, and the parent and child relationships between the tables. Finally, there is a DefaultView object for each table. This is used to create a DataView object based on the table, so that the data can be searched, filtered or otherwise manipulated while displaying the data.

73.How can we connect to Microsoft Access , Foxpro , Oracle etc?

Microsoft provides System.Data.OleDb namespace to communicate with databases like scess , Oracle etc. In short any OLE DB-Compliant database can be connected using System.Data.OldDb namespace.

74.How can you cache different version of same page using ASP.NET cache object ?

Output cache functionality is achieved by using "OutputCache" attribute on ASP.NET page header. Below is the syntax:<%@ outputcache duration="20" location="Server" varybyparam="state" varybycustom="minorversion" varybyheader="Accept-Language" %>1. VaryByParam - Caches different version depending on input parameters send through HTTP POST/GET.2. VaryByHeader - Caches different version depending on the contents of the page header.3. VaryByCustom - Lets you customize the way the cache handles page variations by declaring the attribute and overriding the GetVaryByCustomString handler.4. VaryByControl - Caches different versions of a user control based on the value of properties of ASP objects in the control.

75.How can we force the connection object to close after my datareader is closed ?

Command method Executereader takes a parameter called as CommandBehavior where in we can specify saying close connection automatically after the Datareader is close.pobjDataReader = pobjCommand.ExecuteReader(CommandBehavior.CloseConnection)

76.I want to force the datareader to return only schema of the datastore rather than data?

77.How can we fine tune the command object when we are expecting a single row or a single value?

Again CommandBehaviour enumeration provides two values SingleResult and SingleRow. If you are expecting a single value then pass "CommandBehaviour.SingleResult" and the query is optimized accordingly, if you are expecting single row then pass "CommandBehaviour.SingleRow" and query is optimized according to single row.

78.What are the various methods provided by the dataset object to generate XML?

1. ReadXML - Read’s a XML document in to Dataset.2. GetXML - This is a function which returns the string containing XML document.3. WriteXML - This writes a XML data to disk.

79.How can we save all data from dataset?

Dataset has "AcceptChanges" method which commits all the changes since last time "Acceptchanges" has been executed.

80.How can we check that some changes have been made to dataset since it was loaded ?

For tracking down changes Dataset has two methods which comes as rescue "GetChanges "and "HasChanges".GetChanges Returns dataset which are changed since it was loaded or since Acceptchanges was executed. HasChanges property indicates that has any changes been made since the dataset was loaded or acceptchanges method was executed. If we want to revert or abandon all changes since the dataset was loaded use "RejectChanges".

81.How can we add/remove row’s in "DataTable" object of "DataSet"?

"Datatable" provides "NewRow" method to add new row to "DataTable". "DataTable" has "DataRowCollection" object which has all rows in a "DataTable" object. Following are the methods provided by "DataRowCollection" object :-1. Add - Adds a new row in DataTable.2. Remove - It removes a "DataRow" object from "DataTable". 3. RemoveAt - It removes a "DataRow" object from "DataTable" depending on index position of the "DataTable".

82.What is basic use of "DataView"?

"DataView" represents a complete table or can be small section of rows depending on some criteria. It is best used for sorting and finding data with in "datatable". Dataview has the following method’s :- Find It takes a array of values and returns the index of the row. FindRow This also takes array of values but returns a collection of "DataRow". If we want to manipulate data of "DataTable" object create "DataView" (Using the "DefaultView" we can create "DataView" object) of the "DataTable" object and use the following functionalities :- AddNew Adds a new row to the "DataView" object. 297 Delete Deletes the specified row from "DataView" object.

83.What is the difference between "DataSet" and "DataReader"?

Following are the major differences between "DataSet" and "DataReader" :-1. "DataSet" is a disconnected architecture, while "DataReader" has live connection while reading data. If we want to cache data and pass to a different tier "DataSet" forms the best choice and it has decent XML support.2. When application needs to access data from more than one table "DataSet" forms the best choice.3. If we need to move back while reading records, "datareader" does not support this functionality.4. But one of the biggest drawbacks of DataSet is speed. As "DataSet" carry considerable overhead because of relations, multiple tables etc speed is slower than "DataReader". Always try to use "DataReader" wherever possible, as it’s meant specially for speed performance.

84.How can we load multiple tables in a DataSet?

objCommand.CommandText = "Table1" objDataAdapter.Fill(objDataSet, "Table1")objCommand.CommandText = "Table2" objDataAdapter.Fill(objDataSet, "Table2").Above is a sample code which shows how to load multiple "DataTable" objects in one "DataSet" object. Sample code shows two tables "Table1" and "Table2" in object ObjDataSet. <control>.DataSource = objDataSet.Tables("Table1").DefaultView In order to refer "Table1" DataTable, use Tables collection of DataSet and the Defaultview object will give you the necessary output.

85.How can we add relation’s between table in a DataSet?

Dim objRelation As DataRelation objRelation=New DataRelation("CustomerAddresses",objDataSet.Tables("Customer").Columns("Custid") ,objDataSet.Tables("Addresses").Columns("Custid_fk"))objDataSet.Relations.Add(objRelation)Relations can be added between "DataTable" objects using the "DataRelation" object. Above sample code is trying to build a relationship between "Customer" and "Addresses" "Datatable" using "CustomerAddresses" "DataRelation" object.

86.What is the use of CommandBuilder?

CommandBuilder builds "Parameter" objects automatically. Below is a simple code which uses commandbuilder to load its parameter objects.Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter)pobjCommandBuilder.DeriveParameters(pobjCommand) Be careful while using "DeriveParameters" method as it needs an extra trip to the Datastore which can be very inefficient.

87.What’s difference between "Optimistic" and "Pessimistic" locking?

In pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other user’s can only view the data when there is pessimistic locking. In optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record. This is the most preferred way of locking practically. Now a days browser based application is very common and having pessimistic locking is not a practical solution. H88.how many ways are there to implement locking in ADO.NET?

Following are the ways to implement locking using ADO.NET :-1. When we call "Update" method of DataAdapter it handles locking internally. If the DataSet values are not matching with current data in Database it raises concurrency exception error. We can easily trap this error using Try..Catch block and raise appropriate error message to the user.2. Define a Datetime stamp field in the table.When actually you are firing the UPDATE SQL statements compare the current timestamp with one existing in the database. Below is a sample SQL which checks for timestamp before updating and any mismatch in timestamp it will not update the records. This is the best practice used by industries for locking. Update table1 set field1=@test where LastTimeStamp=@CurrentTimeStamp3. Check for original values stored in SQL SERVER and actual changed values. In stored procedure check before updating that the old data is same as the current. Example in the below shown SQL before updating field1 we check that is the old field1 value same. If not then some one else has updated and necessary action has to be taken. Update table1 set field1=@test where field1 = @oldfield1value. Locking can be handled at ADO.NET side or at SQL SERVER side i.e. in stored procedures.

89.How can we perform transactions in .NET?

The most common sequence of steps that would be performed while developing a transactional application is as follows:-1. Open a database connection using the Open method of the connection object.2. Begin a transaction using the Begin Transaction method of the connection object. This method provides us with a transaction object that we will use later to commit or rollback the transaction. Note that changes caused by any queries executed before calling the Begin Transaction method will be committed to the database immediately after they execute. Set the Transaction property of the command object to the above mentioned transaction object.3. Execute the SQL commands using the command object. We may use one or more command objects for this purpose, as long as the Transaction property of all the objects is set to a valid transaction object.4. Commit or roll back the transaction using the Commit or Rollback method of the transaction object.5. Close the database connection.

90.What is difference between Dataset.clone and Dataset.copy?

Clone - It only copies structure, does not copy data.Copy - Copies both structure and data.

91.Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

There two main basic differences between recordset and dataset :-1. With dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset , with recordset this is not possible2. All representation of Dataset is using XML while recordset uses COM.3. Recordset can not be transmitted on HTTP while Dataset can be.

92.What is Maximum Pool Size in ADO.NET Connection String?

Maximum pool size decides the maximum number of connection objects to be pooled. If the maximum pool size is reached and there is no usable connection available the request is queued until connections are released back in to pool. So it’s always a good habit to either call the close or dispose method of the connection as soon as you have finished work with the connection object.

93.How to enable and disable connection pooling?

For .NET it is enabled by default but if you want to just make sure set Pooling=true in the connection string. To disable connection pooling set Pooling=false in connection string if it is an ADO.NET Connection. If it is an OLEDBConnection object set OLE DB Services=-4 in the connection string.

94.What is WSDL?

Web Service Description Language (WSDL)is a W3C specification which defines XML grammar for describing Web Services.XML grammar describes details such as:-1. Where we can find the Web Service (its URI)?2. What are the methods and properties that service supports?3. Data type support.4. Supported protocols.In short its a bible of what the webservice can do.Clients can consume this WSDL and build proxy objects that clients use to communicate with the Web Services. Full WSDL specification is available at http://www.w3.org/TR/wsdl.

95.What the different phase/steps of acquiring a proxy object in Webservice?

Following are the different steps needed to get a proxy object of a webservice at the client side :-1. Client communicates to UDI node for WebService either through browser or UDDI's public web service.2. UDII responds with a list of webservice. 1663. Every service listed by webservice has a URI pointing to DISCO or WSDL document.4. After parsing the DISCO document, we follow the URI for the WSDL document related to the webservice which we need.5. Client then parses the WSDL document and builds a proxy object which can communicate with Webservice.

96.What is file extension of Webservices?

ASMX is extension for Webservices.

97.Which attribute is used in order that the method can be used as WebService?

WebMethod attribute has to be specified in order that the method and property can be treated as WebService.

98.Do webservice have state?

Webservices as such do not have any mechanism by which they can maintain state. Webservices can access ASP.NET intrinsic objects like Session, application and so on if they inherit from "WebService" base class.<%@ webservice class="TestWebServiceClass" % >Imports System.Web.ServicesPublic class TestWebServiceClass Inherits WebService <webmethod>Public Sub SetSession(value As String)session("Val") = ValueEnd SubEnd ClassAbove is a sample code which sets as session object called as "val". TestWebserviceClass is inheriting from WebService to access the session and application objects.

99.What is a Web Service?

Web Services are business logic components which provide functionality via the Internet using standard protocols such as HTTP. Web Services uses Simple Object Access Protocol (SOAP) in order to expose the business functionality.SOAP defines a standardized format in XML which can be exchanged between two entities over standard protocols such as HTTP. SOAP is platform independent so the consumer of a Web Service is therefore completely shielded from any implementation details about the platform exposing the Web Service. For the consumer it is simply a black box of send and receive XML over HTTP. So any web service hosted on windows can also be consumed by UNIX and LINUX platform.

100.What are basic methods of Dataadapter?

There are three most commonly used methods of Dataadapter :-1. Fill - Executes the SelectCommand to fill the DataSet object with data from the data source. It an also be used to update (refresh) an existing table in a DataSet with changes 285 made to the data in the original datasource if there is a primary key in the table in the DataSet.2. FillSchema :- Uses the SelectCommand to extract just the schema for a table from the data source, and creates an empty table in the DataSet object with all the corresponding constraints.3. Update - Calls the respective InsertCommand, UpdateCommand, or DeleteCommand for each inserted, updated,or deleted row in the DataSet so as to update the original data source with the changes made to the content of the DataSet. This is a little like the UpdateBatch method provided by the ADO Recordset object, but in the DataSet it can be used to update more than one table.

101.What is UDDI?

Full form of UDDI is Universal Description, Discovery and Integration. It is a directory that can be used to publish and discover public Web Services. If you want to see more details you can visit the http://www.UDDI.org

102.What is DISCO?

DISCO is the abbreviated form of Discovery. It is basically used to club or group common services together on a server and provides links to the schema documents of the services it describes may require.