Free e-Book on Asp.Net Architecture, Performance & Scalability

I found a Free E-Book on Asp.Net Web Application Architecture, written by .Net Experts from Microsoft. An essential reading for every .NET Developer & Architect.

This free e-Book provides deep Guidelines about

  • How to Design Scalable, High Performance .Net & Asp.Net Web Applications

  • To help integrate performance engineering throughout your application life cycle

  • To provide deep performance-related technical guidance on the .NET Framework.

  • How to Scale Database with SQL Server.

I found it Very Nice for ASP.Net Web Application Architects.
You can download it at
ASP.NET Architecture Best Practices: Download Free E-Book

ASP.NET 3.5 with VS 2008

I found a good presentation on new features in Asp.NET 3.5 with VS 2008 and journey from Asp, Asp.NET 1.1 to Asp.NET 3.5 with Visual studio 2008.

Visual studio 2008 completely replaces VS 2005. It provides new features like JavaScript intellisense, JavaScript debugging and new CSS editor, and also Unit test automation tools

.NET 3.5 built on top of 2.0 and 3.0. In it, Membership, Role, and Personalization framework exposed as web services.

Language Integrated Querying (LINQ), Native support for latest web protocols (RSS, JSON, etc) are some exciting features. Here is complete presentation.

Difference between DataList and Repeater controls

Asp.Net Interview Question
What is the difference between DataList and Repeater data binding controls?

Answer: The DataList control is similar to the Repeater control. However, it has some additional properties and templates that you can use to display its data in a diverse fashion. The Repeater control does not have any built-in layout or style. We are forced to specify all formatting-related HTML elements and style tags. On the other hand, a DataList control provides more flexibility to display data in a desired layout. It also provides data selection and editing capabilities. How does it do it? Well, in addition to the five templates (Item Template, AlternatingItem Template, Separator Template, Header Template, Footer Template that a repeater has, the DataList control has two more templates: SelectedItemTemplate, and EditItemTemplate. These templates are useful for allowing data selection and data editing functionalities.

Furthermore, the RepeatDirection and RepeatColumns properties of a DataList control can be exploited to lay out the data in horizontal or vertical fashions.

Aggregate Functions in SQL SERVER 2008

What are Aggregate functions? Explain Aggregate functions in SQL SERVER 2008 with example.

Aggregate functions are applied to a group of data values from a column. Aggregate functions always return a single value.

SQL SERVER 2008 / Transact-SQL supports following aggregate functions:

AVG: Calculates the arithmetic mean (average) of the data values contained within a column. The column must contain numeric values.

MAX and MIN: Calculate the maximum and minimum data value of the column, respectively. The column can contain numeric, string, and date/time values.

SUM: Calculates the total of all data values in a column. The column must contain numeric values.

COUNT: Calculates the number of (non-null) data values in a column. The only aggregate function not being applied to columns is COUNT(*). This function returns the number of rows (whether or not particular columns have NULL values).

COUNT_BIG: New and Analogous to COUNT, the only difference being that COUNT_BIG returns a value of the BIGINT data type.

Aggregate function Example:
SELECT ProjectName, SUM(budget) TotalBudget FROM Project_Tbl GROUP BY ProjectName;

More Questions? Ask in comments.

SQL Server Basic Databases

SQL Server Interview Question. Name the Basic or Default Databases of SQL SERVER and What are their functions and use.?

Microsoft SQL SERVER Provides 4 default databases

The Master database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning master database, you must administer this database with care.

The tempdb holds temporary objects such as global and local temporary tables and stored procedures. The model is essentially a template database used in the creation of any new user database created in the instance.

The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.

More Database Questions? Please post in comments.

SQL Server 2008 advantages for Developers

Microsoft has released a new version of its popular Database management system (SQL Server). It is Microsoft SQL Server 2008. So what are the benefits of SQL SERVER 2008 for Developers & Programmers.

SQL Management Studio improvements including IntelliSense.

New Data Types for just dates or times (no more storing time when you only need the date).

New Hierarchical data support .IsDescendent(), that can automatically pull a hierarchical view of data (no more custom recursive queries).

New Grouping Sets statement which enables you to automatically group dimensions in a query for easy aggregation and reporting.

New Merge statement which provides automatic insert/update semantics for keeping multiple data sources in sync.

New data types and support for Geodata and geometry.

New support for optimizing "empty" or row/column tables using the sparse keyword.

New FileStream attribute that enables you to include files that are stored in the server file system, but can be managed by SQL Server.

See SQL SERVER 2008 faqs at
Microsoft SQL SERVER 2008 question answers

Value types VS Reference types C#

What is difference between Value types and Reference types in VB.NET or C# (Value types VS Reference types)

C# provides two types—class and struct, class is a reference type while the other is a value type. Here is difference between 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. With reference types, an object is created in memory, and then handled through a separate reference—rather like a pointer.

Reference types can be self-describing types, pointer types, or interface types. Primitive types such as int, float, bool and char are value 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.

Value types have a default implied constructor that initializes the default value. Reference types default to a null reference in memory.

Value types derive from System.ValueType. Reference types derive from System.Object.

Value types cannot derive a new type from an existing value type, except for structs. Reference types can derive a new type from an existing reference type as well as being able to implement interfaces.

Now you can ask interview question

A new portal for developer community has been launched. Where you can ask any tech question and get answer from tech experts. You can also discuss on any tech topic.

See ASP.Net interview questions discussion at

Multiple - Language Development in .NET Framework

.NET Framework encourages cross-language development using multiple programming languages. To become a .NET language, any language should have a compiler that translates the source code written in different languages into Microsoft Intermediate Language (MSIL).

MSIL code is called as Managed Code. Managed code runs in .NET environment.

In .Net framework the Common Runtime Language (CLR) contains a couple of just-in-time compilers (JIT) which can understand IL Code (managed Code), and can convert IL to native code (binary code targeted at a specific machine processor).

Hence any language with IL Code generating compiler can become a .Net language

Explain the delegates in C#.

Delegates in C# are objects which points towards a function which matches its signature. Delegates are reference type used to encapsulate a method with a specific signature. Delegates are similar to function pointers in C++; however, delegates are type-safe and secure.
Here are some features of delegates:

  • A delegate represents a class.
  • A delegate is type-safe.
  • We can use delegates both for static and instance methods
  • We can combine multiple delegates into a single delegate.
  • Delegates are often used in event-based programming, such as publish/subscribe.
  • We can use delegates in asynchronous-style programming.
  • We can define delegates inside or outside of classes.
Syntax of using delegates

//Declaring delegate
delegate void SampleDelegate(string message);

// declare method with same signature:
static void SampleDelegateMethod(string message) { Console.WriteLine(message); }

// create delegate object
SampleDelegate d1 = SampleDelegateMethod;

// Invoke method with delegate
d1("my program");

What is the purpose of connection pooling in ADO.NET?

Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process.

By default, the connection pool is created when the first connection with a unique connection string connects to the database. The pool is populated with connections up to the minimum pool size. Additional connections can be added until the pool reaches the maximum pool size.

When a user request a connection, it is returned from the pool rather than establishing new connection and, when a user releases a connection, it is returned to the pool rather than being released. But be sure than your connections use the same connection string each time. Here is the Syntax

conn.ConnectionString = "integrated Security=SSPI; SERVER=; DATABASE=MY_DB; Min Pool Size=4;Max Pool Size=40;Connect Timeout=14;";

What is the difference between classes and structs in Microsoft.Net?

  • A struct is a value type, while a class is a reference type.
  • When we instantiate a class, memory will be allocated on the heap. When struct gets initiated, it gets memory on the stack.
  • Classes can have explicit parameter less constructors. But structs cannot have this.
  • Classes support inheritance. But there is no inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.
  • We can assign null variable to class. But we cannot assign null to a struct variable, since structs are value type.
  • We can declare a destructor in class but can not in struct.

What is a Strong Name in Microsoft.Net?

In Microsoft.Net a strong name consists of the assembly's identity. The strong name guarantees the integrity of the assembly. Strong Name includes the name of the .net assembly, version number, culture identity, and a public key token. It is generated from an assembly file using the corresponding private key.
Steps to create strong named assembly:

To create a strong named assembly you need to have a key pair (public key and a private key) file. Use sn -k KeyFile.snk
Open the dot net project to be complied as a strong named assembly. Open AssembyInfo.cs/ AssembyInfo.vb file. Add the following lines to AssemblyInfo file.
[Assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\KeyFile.snk")]

Compile the application, we have created a strong named assembly.

What is the use of XSLT?

XSLT stands for Extensible Stylesheet Language Transformations. This language used in XSL style sheets to transform XML documents into other XML documents.

XSLT is based on template rules which specify how XML documents should be processed. An XSLT processor reads both an XML document and an XSLT style sheet. Based on the instructions the processor finds in the XSLT style sheet, it produce a new XML document. With XSLT we can also produce HTML or XHTML from XML document. With XSLT we can add/remove elements and attributes, rearrange and sort elements, hide and display elements from the output file. Converting XML to HTML for display is probably the most common application of XSLT today.

Explain ACID properties of the database?

All Database systems which include transaction support implement ACID properties to ensure the integrity of the database. ACID stands for Atomicity, Consistency, Isolation and Durability

  • Atomicity: Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails. Modifications on the data in the database either fail or succeed.
  • Consistency: This property ensures that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction will be rolled back and the database will be restored to a state consistent with those rules.
  • Isolation: It requires that multiple transactions occurring at the same time not impact each other’s execution.
  • Durability: It ensures that any transaction committed to the database will not be lost.

What is the basic functionality of Garbage Collector in Microsft.Net?

The Common Language Runtime (CLR) requires that you create objects in the managed heap, but you do not have to bother with cleaning up the memory once the object goes out of the scope or is no longer needed. The Microsoft .NET Framework Garbage Collector provides memory management capabilities for managed resources. The Garbage Collector frees objects that are not referenced and reclaims their memory. You should set your references to Nothing(null) as soon as you are done with them to ensure your objects are eligible for collection as soon as possible.
Here are the list of some tasks performed by the Garbage collector:

  • Garbage collector reserves a piece of memory as the application starts for the managed heap.
  • Garbage collector controls the managed heap memory currently used and available to an application.
  • Garbage collector allocates memory for new objects within the application.
  • The Garbage Collector attempts to reclaim the memory of objects that are not referenced.

What is a static class?

We can declare a static class. We use static class when there is no data or behavior in the class that depends on object identity. A static class can have only static members. We can not create instances of a static class using the new keyword. .NET Framework common language runtime (CLR) loads Static classes automatically when the program or namespace containing the class is loaded.

Here are some more features of static class

  • Static classes only contain static members.
  • Static classes can not be instantiated. They cannot contain Instance Constructors
  • Static classes are sealed.

What is static member of class?

A static member belongs to the class rather than to the instances of the class. In C# data fields, member functions, properties and events can be declared static. When any instances of the class are created, they cannot be used to access the static member.
To access a static class member, use the name of the class instead of an instance variable
Static methods and Static properties can only access static fields and static events.

Like: int i = Car.GetWheels;
Here Car is class name and GetWheels is static property.

Static members are often used to represent data or calculations that do not change in response to object state.

What is the purpose of Server.MapPath method in Asp.Net?

In Asp.Net Server.MapPath method maps the specified relative or virtual path to the corresponding physical path on the server. Server.MapPath takes a path as a parameter and returns the physical location on the hard drive. Syntax

Suppose your Text files are located at D:\project\MyProject\Files\TextFiles

If the root project directory is MyProject and the aspx file is located at root then to get the same path use code

//Physical path of TextFiles
string TextFilePath=Server.MapPath("Files/TextFiles");