Thursday, May 24, 2012

Differences between 1.1 and 2.0 2.0 many new features like

* Partial Classes
Master pages
* Skins and Themes
* Roles and MemberProfiles
* Generics
* Added many new server contols like GridView,DetilsView,FileUpload etc..,
* Web Personalization - Web Parts
* New Folders lime App_Browsers,App_Code,etc..,

Monday, May 21, 2012

View State and Cookies

The ViewState property provides a dictionary object for retaining values between multiple requests for the same page. This is the default method that the page uses to preserve page and control property values between round trips.
When the page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field, or multiple hidden fields if the amount of data stored in the ViewState property exceeds the specified value in the MaxPageStateFieldLength property. When the page is posted back to the server, the page parses the view-state string at page initialization and restores property information in the page.
You can store values in view state as well. For more information on using View State, see ASP.NET View State Overview. For recommendations about when you should use view state, seeASP.NET State Management Recommendations.


<div class="subsection" xmlns="">
A cookie is a small amount of data that is stored either in a text file on the client file system or in-memory in the client browser session. It contains site-specific information that the server sends to the client along with page output. Cookies can be temporary (with specific expiration times and dates) or persistent.
You can use cookies to store information about a particular client, session, or application. The cookies are saved on the client device, and when the browser requests a page, the client sends the information in the cookie along with the request information. The server can read the cookie and extract its value. A typical use is to store a token (perhaps encrypted) indicating that the user has already been authenticated in your application.
For more information about using cookies, see Cookies and ASP.NET State Management Recommendations.
What is are the difference between them?
Some good discussion about the difference between Session and Viewstate : Session Vs ViewState

Why we to go for MVC

There are various positive points to moving towards MVC

1.  TDD support out of the box as most of the design is based on interfaces.
2.  SEO friendly URL by design (though now this is possible in ASP.NET 4 as well)
3.  No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
4.  Clean View Markup (no additional HTML emitted)
5.  100% extensible.  You can add your own controller with IOC, switch view engines at will, control model binding at wish etc.
6.   Rich UI support (possible through client side JS libraries like jQuery UI and others).  Telerik has released some controls for MVC which includes Grid control as well (which are merely HTMLHelpers)
7.  Session, JS, Ajax works.  Validation is even more powerful with DataAnnotations and jquery.
8.  Is MVC faster?  Yes by default because of lack of viewstate and clean markup.  But performance is subject and MVC by design is more performant that traditional ASP.NET webforms (though webforms can be made as fast as required.
9.  Out of the box support for mitigating antiforgery attacks and XSS vulnerability (though does has this to some extent)
10.  Out of the box minimal IOC support.
11.  Full control over rendered HTML
12.  Pluggable architecture
13.   And much more....

Couple of limitations (though not exactly)
1.  Learning curve as most developers are used to windows form model for web development.

NOTE:  Webforms is not bad.  But by design it encourages many bad practices.  A webform at the hands of careful developer is as or could be even more productive than MVC.  Just my thought.

Additional readings at

Authentication & authorization

Thursday, May 17, 2012

Moving Items from One ListBox to other ListBox using JQuery

Following script will move the selected items from one list box item to another list box item.

<asp:ListBox ID="lstBox1" runat="server" SelectionMode="Multiple">
            <asp:ListItem Text="A" Value="1"></asp:ListItem>
            <asp:ListItem Text="B" Value="2"></asp:ListItem>
            <asp:ListItem Text="C" Value="3"></asp:ListItem>
            <asp:ListItem Text="D" Value="4"></asp:ListItem>
<asp:Button ID="btnMoveRight" runat="server" Text=">>" />
<asp:Button ID="btnMoveLeft" runat="server" Text="<<" />
<asp:ListBox ID="lstBox2" runat="server" SelectionMode="Multiple">
            <asp:ListItem Text="E" Value="5"></asp:ListItem>
            <asp:ListItem Text="F" Value="6"></asp:ListItem>
            <asp:ListItem Text="G" Value="7"></asp:ListItem>
            <asp:ListItem Text="H" Value="8"></asp:ListItem>
JQuery script:
$(document).ready(function() {
            $('#<%=btnMoveRight.ClientID %>').click(function() {
                var selectedOptions = $('#<%=lstBox1.ClientID %> option:selected');
                if (selectedOptions.length == 0) {
                    alert("Please select option to move");
                    return false;
                $('#<%=lstBox2.ClientID %>').append($(selectedOptions).clone());
                return false;
            $('#<%=btnMoveLeft.ClientID %>').click(function() {
                var selectedOptions = $('#<%=lstBox2.ClientID %> option:selected');
                if (selectedOptions.length == 0) {
                    alert("Please select option to move");
                    return false;
                $('#<%=lstBox1.ClientID %>').append($(selectedOptions).clone());
                return false;

ASP.NET Open Source Projects

Links to ASP.NET Open Source Projects
  • - A blog engine in
  • dasBlog
  • BlogEngine.NET - Very functional, simple and clean Blog engine in ASP .Net 3.5.
  • SubText - A blogging engine in ASP.NET.
  • Owlpal - Web Content System.
  • AtomSite (formerly BlogSvc) - Built using ASP.NET MVC.
  • Oxite - Built using ASP.NET MVC.
Content Management Systems

Starter Kits
Additional Projects

refer from wiki article

Mobile Applications

 ASP.NET 2.0 enables you to easily create applications targeting such devices.
The following links give you a head start on mobile application development with ASP.NET:
Since most developers will not actually use cellular devices to test their mobile applications, device emulators have been created by companies like Microsoft, Nokia and others for testing purposes. A device emulator is software that simulates a mobile device. The Visual Studio IDE includes built-in emulator SDKs for Pocket PC and SmartPhone.
Working with Device Emulators:
Mobile-enabled Web Forms, MVC application samples

Wednesday, May 9, 2012

Linq to sql or Entity Framework

Entity Framework:
1. Enterprise Development
2. Works with Conceptual model of database
3. Works with all data sources
4. ".EDMX" is created while using Entity Framework

1. Rapid Application Development
2. Works with objects in database
3. Mainly woks with SQL Server
4. ".dbml" is created while using LINQ to SQL

Entity Framework is more targeted towards Enterprise Development where the schema is usually optimized for storage considerations like performance consistency and partitioning. Entity Framework is designed around exposing an application-oriented data model that is loosely coupled and may differ from the existing database schema. For example, you can map a single entity (class) to multiple or map multiple entities to the same table. Entity Framework has “.edmx” (ADO.NET Entity Model) file when added in the application.

LINQ to SQL mainly has features to support Rapid Application Development against SQL Server. LINQ to SQL allows you to have a strongly typed view of your existing database schema. You can build LINQ queries over tables and return results as strong typed objects. LINQ to SQL has “.dbml”(LINQ to SQL) file when added in the application. You can use LINQ to SQL by decorating the existing classes with the attributes.

Please review: Entity Framework Basics

Tuesday, May 8, 2012

.Net Framework Versions

Version Number
Release Date
Visual Studio Framework
 Operating System
Visual Studio .NET
Windows Server 2003
Visual Studio .NET 2003
Windows Server 2003
Visual Studio 2005
Windows Server 2003 R2
Visual Studio 2005
Windows Vista, Windows Server 2008
Visual Studio 2008
Windows 7, Windows Server 2008 R2
Visual Studio 2010
Windows 7, Windows Server 2008 R2

Now we can read about all the new functionality that we are making available as pat of ASP.NET 4.5 and Visual Studio 11 Developer Preview at the following page:

how to increase SEO(search engine optimization)