Main Differences between ASP.NET 3.5 and ASP.NET 4.0

As we all know, ASP.NET 3.5 has introduced with the following main new features

1) AJAX integration
3) Automatic Properties
4) Lambda expressions

I hope it would be useful for everyone to know about the differences about 3.5 and its next version 4.0

Because of space consumption I’ll list only some of them here.

1) Client Data access:

ASP.NET 3.5: There is no direct method to access data from client side. We can go for any of these methods

1) Pagemethods of script manager
2) ICallbackEventHandler interface
3) XMLHttphanlder component

ASP.NET 4.0: In this framework there is an inbuilt feature for this. Following are the methods to implement them.

1) Client data controls
2) Client templates
3) Client data context

i.e we can access the data through client data view & data context objects from client side.

2) Setting Meta keyword and Meta description:

Meta keywords and description are really useful for getting listed in search engine.

ASP.NET 3.5: It has a feature to add meta as following tag

&ltmeta name="keywords" content="These, are, my, keywords" />
  &ltmeta name="description" content="This is the description of my page" />

ASP.NET 4.0: Here we can add the keywords and description in Page directives itself as shown below.

< %@ Page Language="C#"  CodeFile="Default.aspx.cs"
  Description="description" %>

3) Enableviewstage property for each control

ASP.NET 3.5: this property has two values “True” or “false”

ASP.NET 4.0: ViewStateMode property takes an enumeration that has three values: Enabled, Disabled, and Inherit.
Here inherit is the default value for child controls of a control.

4) Setting Client IDs

Some times ClientID property creates head ach for the programmers.

ASP.NET 3.5: We have to use ClientID property to find out the id which is dynamically generated

ASP.NET 4.0: The new ClientIDMode property is introduced to minimize the issues of earlier versions of ASP.NET.

It has following values.

AutoID – Same as ASP.NET 3.5
Static – There won’t be any separate clientid generated at run time
Predictable-These are used particularly in datacontrols. Format is like clientIDrowsuffix with the clientid vlaue
Inherit- This value specifies that a control’s ID generation is the same as its parent.


Pascal Triangle

The following code sample shows how to create pascaltriangle

using System;
using System.Collections.Generic;

class PascalTriangle
static void Main()
foreach (uint[] row in GetPascalTriangle())

static void Print(uint[] row)
foreach (uint e in row)
Console.Write(“{0}\t”, e);

static IEnumerable GetPascalTriangle()
uint[] row = new uint[1] { 1 };

for(int n = 2; ; n++)
yield return row;

uint[] nrow = new uint[n];
Array.Copy(row, nrow, n-1);
for (int i = 1; i < n; i++)
nrow[i] += row[i-1];
row = nrow;

The MapPath method

The ASP.NET Page object exposes the MapPath method, which converts a virtual path into a physical path, so it’ is useful for passing arguments to objects that don’t work with virtual paths:

Dim sr As New System.IO.StreamReader(Me.MapPath(“/data/values.dat”))

You can also use MapPath to retrieve information onabout the current ASP.NET application, for exampleas you see in this snippet:

' The current directory Dim currDir As String = Me.MapPath(".") ' The parent directory Dim parentDir As String = Me.MapPath("..") ' The root directory Dim rootDir As String = Me.MapPath("/")
%d bloggers like this: