DotNetSlackers: ASP.NET News for lazy Developers

Saturday, December 25, 2010

ASP.NET Page Life Cycle Overview

StageDescription
Page requestThe page request occurs before the page life cycle begins. When the page is requested by a 
user, ASP.NET determines whether the page needs to be parsed and compiled (therefore
 beginning the life of a page), or whether a cached version of the page can be sent in
 response without running the page.
StartIn the start stage, page properties such as Request and Response are set. At this stage, the
 page also determines whether the request is a postback or a new request and sets the
 IsPostBack property. The page also sets the UICulture property.
InitializationDuring page initialization, controls on the page are available and each control's UniqueID
 property is set. A master page and themes are also applied to the page if applicable. If the
 current request is a postback, the postback data has not yet been loaded and contro
l property values have not been restored to the values from view state.
LoadDuring load, if the current request is a postback, control properties are loaded with
 information recovered from view state and control state.
Postback event handlingIf the request is a postback, control event handlers are called. After that, the Validate method
 of all validator controls is called, which sets the IsValid property of individual validator 
controls and of the page.
RenderingBefore rendering, view state is saved for the page and all controls. During the rendering stage, the page calls the
 Render method for each control, providing a text writer that writes its output to the OutputStream object of the page's Responseproperty.
UnloadThe Unload event is raised after the page has been fully rendered, sent to the client, and is 
ready to be discarded. At this point, page properties such as Response and Request are
 unloaded and cleanup is performed.

ASP.NET Dynamic Data Framework

ASP.NET Dynamic Data brings major usability and RAD development changes to the existing ASP.NET data controls. RAD development is significantly increased by the use of a rich scaffolding framework. After you add a LINQ to SQL or Entity Framework data model to a project, you can simply register it with Dynamic Data. The result is a fully functional Web site. Full CRUD (create, read, update, and delete) operations are supported. The site includes filtering by foreign keys and Boolean fields; foreign keys are automatically converted to their friendly names. Smart validation is automatically available, which provides validation based on database constraints for nullable fields, data type, and field length.

The DetailsView and GridView controls have been extended to display fields by using templates instead of by using hard-coded rules that are programmed in the controls. These templates are part of the project, and you can customize them to change their appearance or to specify which controls they use for rendering. This makes it very easy to make a change in one place in your site that specifies how to present dates for editing, as one example. FormView and ListView controls can implement similar behavior by using a DynamicControl object in their templates and by specifying which field in the row to display. Dynamic Data will then automatically build the UI for these controls based on the templates that you specify. 

Validation is significantly improved in the controls as well. The controls read metadata for a LINQ to SQL or Entity Framework data model and provide automatic validation based on the model. For example, if a column in the database is limited to 50 characters, and if a column is marked as not nullable, aRequiredFieldValidator control is automatically enabled for the column. (The controls also automatically support data-model-level validation.) You can apply other metadata to take further control over display and validation. 

Silverlight Technology

Silverlight is a powerful development platform for creating rich media applications and business applications for the Web, desktop, and mobile devices.
Silverlight is a free plug-in powered by the .NET framework that is compatible across multiple browsers, devices and operating systems to bring a new level of interactivity wherever the Web works. With support for advanced data integration, multithreading, HD video using IIS Smooth Streaming, and built in content protection, Silverlight enables online and offline applications for a broad range of business and consumer scenarios.
Silverlight is being pushed side-by-side with Microsoft's Live services for developers. Microsoft is opening up APIs (application program interfaces) for its search engine, for Virtual Earth, for its instant messaging service, and for other services, under generous, but not unlimited, licensing terms. These services will allow the creation of interesting online applications that take advantage of existing Microsoft networks and resources. For example, Match.com today demoed a new version of its service that can connect directly to other Match.com subscribers who are MSN Messenger users. Mash-ups are nothing new, of course, but it is important that Microsoft is giving developers access to its computing resources as well as its user base.
Silverlight supports the display of high-definition video files, and importantly, Microsoft will do the heavy lifting of sending them over the Net. Streaming large media files is expensive, but Microsoft will (optionally) host Silverlight media files and applications. This will enable smaller developers to deliver large and high-definition files quickly and reliably, without paying content distribution network fees. Microsoft is promising reliable 700kbps throughput for media files, and free distribution of all content on its network for one year. After that, distribution will continue to be free up to 1 million streamed minutes a month. Fees after that have not been set.
Also, Silverlight applications are delivered to a browser in a text-based markup language called XAML. That's no big deal for Web users once they land on a site. But search engines, like Google, can scan XAML. They can't dive into compiled Flash applications. Flash-heavy sites do often wrap their applications in Web code that search engines can crawl, although it's extra work for developers and designers to do it, and may not yield search results that are as good as they would be if the search engine was indexing the actual application instead of keywords tacked on after the fact. Silverlight applications will be more findable.
One thing Silverlight isn't though, is a competitor to Apollo (hands-on), Adobe's technology that lets developers take their online applications and make them into standalone desktop apps. Apollo developers will be able to take advantage of capabilities that make applications behave properly whether they are online or not. Silverlight does not yet offer those capabilities, although I heard that apps written in Silverlight will be able to modify the "chrome" or basic user interface of a browser while they are running, to further obscure the difference between a browser-based app and traditional software.


ADO.NET Data Services Framework

The ADO.NET Data Services framework consists of patterns and libraries that enable the creation and consumption of REST-based data services for the web. This update to the Microsoft .NET Framework 3.5 SP1 provides additional features which extend the functionality provided in version 1.0 of the ADO.NET Data Services framework. 

The ADO.NET Data Services Update for .NET Framework 3.5 SP1 provides the following new features and improvements:

  • Built-in integration in Microsoft Office 2010 now makes it simple to expose Microsoft Office SharePoint Server data as a data service and access that data using the ADO.NET Data Services client library.
  • Custom Data Service Provider support now makes it easier to build an ADO.NET Data Service over any data source.
  • A new DataServiceCollection class has been added that supports rich two-way data binding. The new collection implements automatic change tracking on client side objects created using the ADO.NET Data Services client library.
  • Feed customization, provides a rich and flexible way to shape and modify the structure of ATOM feeds produced by an ADO.NET Data Service. Modifying the structure of the ATOM feed produced by the ADO.NET Data Services makes it possible for third-party clients that can consume an ATOM feed in a custom format to consume feeds from an ADO.NET Data Service.
  • Enhanced blob support for streaming large binary objects to/from a data service. Support has also been added to the ADO.NET Data Services client library to provide the ability to upload and download binary objects (such as: images, videos, documents, etc.) from an application created using the library.
  • Server-driven paging allows a service author to limit the size of the result set returned by a query; this gives the service author a new level of control over the network bandwidth and computation time required to process any request.
  • A new select query option allows the result of a query to be projected into an arbitrary type; projecting gives the client the ability to request a specific set of properties of an entity. Reducing the number of properties requested in a query reduces processing time and network bandwidth for the request.
  • The option to request a count of the number of entities in a set and the option to include the total count of the number of entities in the set when a query returns a partial result.
  • Request pipeline improvements give the service author greater control and customization ability over various stages of query processing

ADO.NET Data Services Framework

The ADO.NET Data Services framework consists of patterns and libraries that enable the creation and consumption of REST-based data services for the web. This update to the Microsoft .NET Framework 3.5 SP1 provides additional features which extend the functionality provided in version 1.0 of the ADO.NET Data Services framework. 

The ADO.NET Data Services Update for .NET Framework 3.5 SP1 provides the following new features and improvements:

  • Built-in integration in Microsoft Office 2010 now makes it simple to expose Microsoft Office SharePoint Server data as a data service and access that data using the ADO.NET Data Services client library.
  • Custom Data Service Provider support now makes it easier to build an ADO.NET Data Service over any data source.
  • A new DataServiceCollection class has been added that supports rich two-way data binding. The new collection implements automatic change tracking on client side objects created using the ADO.NET Data Services client library.
  • Feed customization, provides a rich and flexible way to shape and modify the structure of ATOM feeds produced by an ADO.NET Data Service. Modifying the structure of the ATOM feed produced by the ADO.NET Data Services makes it possible for third-party clients that can consume an ATOM feed in a custom format to consume feeds from an ADO.NET Data Service.
  • Enhanced blob support for streaming large binary objects to/from a data service. Support has also been added to the ADO.NET Data Services client library to provide the ability to upload and download binary objects (such as: images, videos, documents, etc.) from an application created using the library.
  • Server-driven paging allows a service author to limit the size of the result set returned by a query; this gives the service author a new level of control over the network bandwidth and computation time required to process any request.
  • A new select query option allows the result of a query to be projected into an arbitrary type; projecting gives the client the ability to request a specific set of properties of an entity. Reducing the number of properties requested in a query reduces processing time and network bandwidth for the request.
  • The option to request a count of the number of entities in a set and the option to include the total count of the number of entities in the set when a query returns a partial result.
  • Request pipeline improvements give the service author greater control and customization ability over various stages of query processing

The ADO.NET Entity Framework

Introduction

When one takes a look at the amount of code that the average application developer must write to address the impedance mismatch across various data representations (for example objects and relational stores) it is clear that there is an opportunity for improvement. Indeed, there are many scenarios where the right framework can empower an application developer to focus on the needs of the application as opposed to the complexities of bridging disparate data representations.
A primary goal of the upcoming version of ADO.NET is to raise the level of abstraction for data programming, thus helping to eliminate the impedance mismatch between data models and between languages that application developers would otherwise have to deal with. Two innovations that make this move possible are Language-Integrated Query and the ADO.NET Entity Framework. The Entity Framework exists as a new part of the ADO.NET family of technologies. ADO.NET will LINQ-enable many data access components: LINQ to SQL, LINQ to DataSet and LINQ to Entities.
This document describes the ADO.NET Entity Framework, what problem spaces it is targeting and how its various components address those problems.

The ADO.NET Entity Framework: Modeling at the Right Level of Abstraction

Every business application has, explicitly or implicitly, a conceptual data model that describes the various elements of the problem domain, as well as each element's structure, the relationships between each element, their constraints, and so on.
Since currently most applications are written on top of relational databases, sooner or later they'll have to deal with the data represented in a relational form. Even if there was a higher-level conceptual model used during the design, that model is typically not directly "executable", so it needs to be translated into a relational form and applied to a logical database schema and to the application code.
While the relational model has been extremely effective in the last few decades, it's a model that targets a level of abstraction that is often not appropriate for modeling most business applications created using modern development environments.
Let's use an example to illustrate this point. Here is a fragment of a variation of the AdventureWorks sample database that's included in Microsoft SQL Server 2005:

Advantages of a Web Forms-Based Web Application

The Web Forms-based framework offers the following advantages:
  • It supports an event model that preserves state over HTTP, which benefits line-of-business Web application development. The Web Forms-based application provides dozens of events that are supported in hundreds of server controls.
  • It uses a Page Controller pattern that adds functionality to individual pages. 
  • It uses view state or server-based forms, which can make managing state information easier.
  • It works well for small teams of Web developers and designers who want to take advantage of the large number of components available for rapid application development.
  • In general, it is less complex for application development, because the components (the Page class, controls, and so on) are tightly integrated and usually require less code than the MVC model.

Advantages of an MVC-Based Web Application

The ASP.NET MVC framework offers the following advantages:
  • It makes it easier to manage complexity by dividing an application into the model, the view, and the controller.
  • It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application.
  • It uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure.
  • It provides better support for test-driven development (TDD).
  • It works well for Web applications that are supported by large teams of developers and Web designers who need a high degree of control over the application behavior.
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc namespace and is a fundamental, supported part of the System.Web namespace.

MVC is a standard design pattern that many developers are familiar with. Some types of Web applications will benefit from the MVC framework. Others will continue to use the traditional ASP.NET application pattern that is based on Web Forms and postbacks. Other types of Web applications will combine the two approaches; neither approach excludes the other.

The MVC framework includes the following components:
  • Models. Model objects are the parts of the application that implement the logic for the application s data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in SQL Server.

In small applications, the model is often a conceptual separation instead of a physical one. For example, if the application only reads a data set and sends it to the view, the application does not have a physical model layer and associated classes. In that case, the data set takes on the role of a model object.
  • Views. Views are the components that display the application s user interface (UI). Typically, this UI is created from the model data. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Products object.

  • Controllers. Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn queries the database by using the values.

The MVC pattern helps you create applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application. The UI logic belongs in the view. Input logic belongs in the controller. Business logic belongs in the model. This separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time. For example, you can focus on the view without depending on the business logic.

In addition to managing complexity, the MVC pattern makes it easier to test applications than it is to test a Web Forms-based ASP.NET Web application. For example, in a Web Forms-based ASP.NET Web application, a single class is used both to display output and to respond to user input. Writing automated tests for Web Forms-based ASP.NET applications can be complex, because to test an individual page, you must instantiate the page class, all its child controls, and additional dependent classes in the application. Because so many classes are instantiated to run the page, it can be hard to write tests that focus exclusively on individual parts of the application. Tests for Web Forms-based ASP.NET applications can therefore be more difficult to implement than tests in an MVC application. Moreover, tests in a Web Forms-based ASP.NET application require a Web server. The MVC framework decouples the components and makes heavy use of interfaces, which makes it possible to test individual components in isolation from the rest of the framework.

The loose coupling between the three main components of an MVC application also promotes parallel development. For instance, one developer can work on the view, a second developer can work on the controller logic, and a third developer can focus on the business logic in the model.



ASP.NET is NOT ASP

ASP.NET is the next generation ASP, but it's not an upgraded version of ASP.
ASP.NET is an entirely new technology for server-side scripting. It was written from the ground up and is not backward compatible with classic ASP.
You can read more about the differences between ASP and ASP.NET in the next chapter of this tutorial.
ASP.NET is the major part of the Microsoft's .NET Framework.

Visual Web Developer

Visual Web Developer is a full-featured development environment for creating ASP.NET Web applications. Visual Web Developer offers you the following features:
  • Web page design   A powerful Web page editor that includes WYSIWYG editing and an HTML editing mode with IntelliSense and validation.
  • Page design features   Consistent site layout with master pages and consistent page appearance with themes and skins.
  • Code editing   A code editor that enables you to write code for your dynamic Web pages in Visual Basic or C#. The code editor includes syntax coloration and IntelliSense.
  • Testing and Debugging   A local Web server for testing and a debugger that helps you find errors in your programs.
  • Deployment   Tools to automate typical tasks for deploying a Web application to a hosting server or a hosting provider.


    Using Visual Studio 2010, you can create different types of ASP.NET projects, which includes Web sites, Web applications, Web services, and AJAX server controls.
    There is a difference between Web site projects and Web application projects. Some features work only with Web application projects, such as MVC and certain tools for automating Web deployment. Other features, such as Dynamic Data, work with both Web sites and Web application projects. For more information about the differences between Web application projects and Web site projects

    ASP.NET API Reference
    Some of the most important namespaces in the .NET Framework class library that pertain to ASP.NET are the following:
    System.web
    Provides classes and interfaces that enable browser-server communication. This namespace includes the HttpRequest class, which provides extensive information about the current HTTP request, the HttpResponse class, which manages HTTP output to the client, and the HttpServerUtility class, which provides access to server-side utilities and processes. System.Web also includes classes for cookie manipulation, file transfer, exception information, and output cache control.
    System.Web.ApplicationServices
    Provides classes that provide access to ASP.NET forms authentication, roles, and profiles application services as Windows Communication Foundation (WCF) services.
    System.Runtime.Caching
    Contains types that let you implement caching in .NET Framework applications.
    System.Web.ClientServices
    Contains classes that support access to the ASP.NET login, roles, and profiles services from Windows-based applications.
    System.Web.Configuration
    Contains classes that are used to programmatically manage ASP.NET configuration. (Most configuration settings can be made in XML files.)
    System.Web.DynamicData
    Contains classes that provide the core functionality for ASP.NET dynamic data and extensibility features that let you customize dynamic data behavior.
    System.Web.Handlers
    Contains HTTP handler classes that process HTTP requests to a Web server. (An ASP.NET Web Forms page -- .aspx file -- is a special form of an HTTP handler.)
    System.Web.Management
    Contains classes and interfaces for managing and monitoring the health of Web applications.
    System.Web.Profile
    Contains classes that are used to implement the ASP.NET user profile in Web server applications.
    System.Web.Query.Dynamic
    Contains classes that are used to parse expressions from a LinqDataSource control into a Language-Integrated Query (LINQ).
    System.Web.RegularExpressions
    Provides regular expressions that are used to parse ASP.NET files. All members of the System.Web.RegularExpressions namespace are descendants of the Regex class. (You typically do not have to parse ASP.NET pages yourself.)
    System.Web.Routing
    Provides classes that are used with URL routing, which enables you to use URLs that do not map to a physical file.
    System.Web.Script
    Contains classes that provide client-script resource information.
    System.Web.Script.Services
    Provides attributes to customize Web service support for using Ajax functionality in ASP.NET.
    System.Web.Security
    Contains classes that are used to implement ASP.NET security in Web server applications.
    System.Web.Services
    Consists of the classes that enable you to create XML Web services using ASP.NET and XML Web service clients. XML Web services are applications that provide the ability to exchange messages in a loosely coupled environment using standard protocols such as HTTP, XML, XSD, SOAP, and WSDL. XML Web services let you build modular applications that are interoperable across a broad variety of implementations, platforms, and devices.
    System.Web.SessionState
    Contains classes and interfaces that enable storage of data specific to a single client during a single browser session on the server. Session state data is used to give the client the appearance of a persistent connection with the application.
    System.Web.UI
    Provides classes and interfaces that enable you to create ASP.NET server controls and ASP.NET Web pages for the user interface of your ASP.NET Web applications. This namespace includes the Control class, which provides all HTML server controls, Web server controls, and user controls with a common set of functionality. It also includes the Page control, which is generated automatically whenever a request is made for an .aspx file in an ASP.NET Web application. Also included are classes which provide the server controls with data-binding functionality, the ability to save the view state of a given control or page, and parsing functionality.
    System.Web.UI.DataVisualization.Charting
    Contains types for the Chart Web server control.
    System.Web.UI.Design.WebControls
    Contains classes that can be used to extend design-time support for Web server controls.
    System.Web.UI.Design.WebControls.WebParts
    Contains classes that provide design-time support for controls derived from classes in the System.Web.UI.WebControls.WebParts namespace.
    System.Web.UI.HtmlControls
    Contains a collection of classes that enable you to create HTML server controls on a Web Forms page. HTML server controls run on the server and map directly to standard HTML tags supported by most browsers. This enables you to programmatically control the HTML elements on a Web Forms page.
    System.Web.UI.WebControls
    Contains classes that enable you to create Web server controls on a Web page. Web server controls run on the server and include form controls such as buttons and text boxes. They also include special-purpose controls such as a calendar. Because Web server controls run on the server, you can programmatically control these elements. Web server controls are more abstract than HTML server controls. Their object model does not necessarily reflect HTML syntax.
    System.Web.UI.WebControls.WebParts
    Contains an integrated set of classes and interfaces for creating Web pages whose appearance and behavior can be modified (personalized) by end users. The user-defined settings for each page are saved for future browser sessions.
    System.Web.Util
    Contains classes that enable callback methods to be run under the scope of a transaction and that enable work to be posted to separate threads.
    ASP.NET MVC Reference
    This topic provides links to four namespaces that are used by the MVC framework.







Tuesday, December 21, 2010

LINQ

LINQ Tutorial Objectives:
•        Understand the role of implicitly typed local variables
•        Understand the role of extension methods
•        Understand object initialization syntax
•        Understand the role of anonymous types
•        Understand the role of lambda expressions


With the release of .NET 3.5, the C# and VB programming languages have been upgraded with a number of 
new syntactic constructs. Here you will examine implicit data typing, extension methods, object initializers, 
anonymous types, and lambda expressions.
Although these new language features can be used in any type of .NET 3.5 application, these new constructs 
are especially useful when programming with LINQ technologies, which the next chapter introduces.

Introducing the Core .NET 3.5 Language Changes 
Most releases of the .NET platform include changes to the C# and VB programming languages. .NET 3.0 did 
not alter the C# or VB languages but introduced three new APIs (WPF, WCF, and WF). .NET 3.5 not only 
introduces new APIs but many new syntactical constructs for C# and VB. .NET 3.5 brings a slew of new 
language features, far more than any prior release of the Framework.

In this chapter, you will examine the following new programming constructs:
     •        Implicit typing of local variables.
     •        Extension methods.
     •        Object initialization syntax.
     •        Anonymous types.
     •        Lambda expressions.

.NET 3.5 also updates C# 3.0 and VB 9.0 with some additional minor but useful programming constructs. C# 
now supports partial methods and automatic properties. VB supports partial methods and relaxed delegates.
Consult the .NET Framework 3.5 SDK documentation for details on these updates.

The new .NET 3.5 programming constructs can be used within any .NET application. As you will see, 
however, the major benefit of these new features is that they enable the LINQ programming model. To be 
sure, when programming with LINQ, you will need to make use of the features shown here.
Introducing Implicitly Typed Local Variables  
                          
C# 3.0 and VB 9.0 now support 
implicit typing of local variables. This is in contrast to explicit typing of local 
variables, which is achieved using a very predictable syntax based on your language of choice.

Using explicit typing, the developer knows ahead of time the ‘type of type’ for a local variable (System.
Int32, System.Boolean, System.String, and so on). Consider the following use of explicit typing:

// C#static void ExplicitLocalVars()
{
// Explicitly typed local variables are declared in C# as follows:
// dataType variableName = initialValue;
int myInt = 0;
bool myBool = true;
string myString = "Time, marches on...";
}


' VBSub ExplicitLocalVars()' Explicitly typed local variables are declared in VB as follows:
' Dim variableName As dataType = initialValue
Dim myInt As Integer = 0
Dim myBool As Boolean = True
Dim myString As String = "Time, marches on..."
End Sub
 



The underlying type of an implicitly typed local variable is determined at compile time. The underlying type 
is based on the initial assignment of the implicit variable. This can be verified via reflection services. Consider 
the following C# code (the corresponding VB code would be similar):

// C# (VB code would be similar)static void ImplicitLocalVars()
{
Console.WriteLine("***** Fun with Implicit Typing *****\n");
// Implicitly typed local variables.var myInt = 0;
var myBool = true;
var myString = "Time, marches on...";
// Print out the underlying type via reflection.Console.WriteLine("myInt is a: {0}", myInt.GetType().Name);
Console.WriteLine("myBool is a: {0}", myBool.GetType().Name);
Console.WriteLine("myString is a: {0}", myString.GetType().Name);
}

Windows CardSpace

f you're like many people, you carry identification—a passport, drivers license, credit card, or an employee or student ID card. Merchants and financial institutions use identification to verify your identity to help protect you from theft and fraud. Sometime in the not-so-distant-future, you’ll use similar identification in the online world. Information Cards are personal identification that you can use on a website in a similar manner to the way that you use your current identification today.
Information cards use digital signatures to prevent imposters. When you send an information card to a website, the "card" identifies you with a digital signature, shows what website you sent it to, and indicates when it was sent. Information cards are safer to use than usernames and passwords for sign-in to a website because digital signatures make them very difficult to forge.
Information cards are also convenient. Because information cards are protected with signatures, you can safely use one information card at many websites without creating a new account and password at every site you visit, just as you can with your offline identification.
To get started with information cards, you can install Windows CardSpace and use it to sign in to one of the websites that support information cards today.

How does Windows CardSpace work?

Windows CardSpace is client software that makes it possible for users to provide their digital identity to online services in a more simple and secure way. It is an online virtual information card—an ID card for the Internet—that helps prove a user's identity, and it is very difficult to fake or steal.
Each information card has some identity data associated with it—although this data is not actually stored in the card. The identity data has either been given to the user by an identity provider such as bank, employer, or government, or that has been created by the users themselves.
Information cards are virtual representations of a person's identity that are validated by a separate party. Information cards are analogous to real-world identity cards such as passports, driver's licenses, credit cards, and employee ID cards.
Advantages of Windows CardSpace information cards include:
  • Information cards are more flexible than simple user names and passwords.
  • Information cards provide a consistent user experience.
  • Information cards employ strong cryptography, which makes using them more secure than using passwords.
  • Information cards can present any type of identity claim that makes sense to all of the interacting parties and which users are willing to release.

Information for consumers

Today's consumers are concerned about using the Internet as a result of security risks and the hassle of maintaining user names and passwords for multiple sites. A user may use the same password for multiple sites. This makes it easier for the user to remember the password, but it compounds the problem if someone is able to steal that password. However, with information cards, you can use one information card for all the sites you visit, several information cards for specialized purposes (work and personal), or any combination of the two.
Using the Microsoft identity selector, Windows CardSpace, puts consumers in control of the information that they release about themselves, making tasks such as online purchasing quicker, easier, and more secure.

Information for businesses

The Microsoft identity selector, Windows CardSpace, makes it easier for businesses to build brand loyalty with customers and set up partnerships with other organizations. It also makes it simpler for employees to quickly gain access to the systems they need, while ensuring that former employees no longer pose a security risk.

Windows CardSpace partner network

Microsoft is working with a broad range of businesses, organizations, and vendors to help them understand how they can take advantage of Windows CardSpace and offer these benefits to their customers and partners

Windows Communication Foundation

Windows Communication Foundation is one of main new technologies that are included in .NET 3.0. In this article, as the first part of his Windows Communication Foundation tutorials, Keyvan introduces Windows Communication Foundation and some principles behind it.

NET 3.0 comes with three main technologies in core: Windows Presentation Foundation, Windows Workflow Foundation and Windows Communication Foundation.  In past tutorials I introduced Windows Presentation Foundation and XAML and now I want to try things for Windows Communication Foundation.
Windows Communication Foundation (WCF), codenamed Indigo in Microsoft, is the last generation of service oriented technologies for development.  It provides all the latest means to help developers build service oriented applications.  The result of service oriented design is a distributed system which runs between services and clients.  Windows Communication Foundation is Microsoft infrastructure for Service Oriented architecture.
You have probably worked with Web Services in .NET 1.x or 2.0 and may have some experiences with Remoting.  Windows Communication Foundation is an enhanced technology to provide the same functionality with better features and reduces the time to develop a distributed system.  Web Services and Services are not identical.  One main difference is Web Services use HTTP protocol, but Services can use any protocol and this is an important difference.
The first part of this article is a Windows Communication Foundation tutorials; I introduce this new technology, its architecture, programming model, service orientated design and give some other necessary information to start with this technology.

Windows Presentation Foundation

The Microsoft Windows Presentation Foundation (formerly code named "Avalon") provides the foundation for building applications and high fidelity experiences in Longhorn, blending together application UI, documents, and media content, while exploiting the full power of your computer.

The Windows Presentation Foundation is Microsofts next generation UI framework to create applications with a rich user experience. It is part of the .NET framework 3.0 and higher.
WPF combines application UIs, 2D graphics, 3D graphics, documents and multimedia into one single framework. Its vector based rendering engine uses hardware acceleration of modern graphic cards. This makes the UI faster, scalable and resolution independent.
The followinig illustration gives you an overview of the main new features of WPF

Separation of Appearance and Behavior

WPF separates the appearance of an user interface from its behavior. The appearance is generally specified in the Extensible Application Markup Language (XAML), the behavior is implemented in a managed programming language like C# or Visual Basic. The two parts are tied together by databinding, events and commands. The separation of appearance and behavior brings the following benefits:
  • Appearance and behaviour are loosely coupled
  • Designers and developers can work on separate models.
  • Graphical design tools can work on simple XML documents instead of parsing code.

Rich composition

Controls in WPF are extremely composable. You can define almost any type of controls as content of another. Although these flexibility sounds horrible to designers, its a very powerful feature if you use it appropriate. Put an image into a button to create an image button, or put a list of videos into a combobox to choose a video file.
 
<Button>
    <StackPanel Orientation="Horizontal">
        <Image Source="speaker.png" Stretch="Uniform"/>
        <TextBlock Text="Play Sound" />
    </StackPanel>
</Button>
 
 

Highly customizable

Because of the strict separation of appearance and behavior you can easily change the look of a control. The concept ofstyles let you skin controls almost like CSS in HTML. Templates let you replace the entire appearance of a control.
The following example shows an default WPF button and a customized button.

Windows Workflow Foundation

Windows Workflow Foundation (WF) is one of the parts of the .NET 3.0 framework as released by Microsoft. One of the most interesting aspects of Windows Workflow Foundation (WF) is the separation between business process code and the actual implementation, often a requirement in Service Oriented Architecture (SOA). Before Windows Workflow Foundation the typical scenario would be to write both the business logic and the actual implementation in C#, Visual Basic .NET or another .NET language. The result was no clear separation between business logic and its implementation. With the release of Windows Workflow Foundation (WF) the business logic can be defined in the workflow while the actual underlying implementation is done in C#, Visual Basic .NET or another .NET language. So basically the what is done in the workflow and thehow is done in traditional programming code.
The best way to look at a workflow is as a schematic description of a real world problem. For example: If an order is placed, check if we have enough inventory and if not create a purchase order and send it to the supplier, notify the account manager by email of the expected delivery date the supplier specified. These activities are modeled in a graphical way making the workflow much more understandable. The activities themselves, like sending an email, are done in traditional C# or Visual Basic .NET code in such a way that they are unaware of their context, all they know is that they have to send an email as told by the workflow.

Windows Workflow Foundation is basically a library consisting of an execution engine, a rules engine, a number of activities, a number of supporting runtime services and a designer allowing developers to design their workflows graphical in Visual Studio 2005 (VS2005). In fact it even includes a graphical debugger allowing the developer to step through the workflow and even into the underlying .NET code. The engine is designed in such a way that the developer has a free choice between building the workflow as code constructs or in a declarative fashion using XAML. Either way he can use the graphical designer the same way, all that changes is the output. Because the runtime engine has the capability of parsing and executing the XAML itself we have tremendous flexibility in our workflows. There is no need to compile them at the same time as the rest of the application. This flexibility even goes further and the engine allows for the runtime alteration of the executing workflow, how about that for flexibility!
Because Windows Workflow Foundation is a library, not a standalone platform or service, the developer is completely free to include the Windows Workflow Foundation library in process in his own application or web site/service. This can be of great benefit to existing applications where using a separate workflow server, like BizTalk 2006, would be prohibitive. Because of the modular way Windows Workflow Foundation is designed, the developer is free to replace standard services like persistence, scheduling or tracking with another implementation if he or she so desires.
The .NET basis ensures full interoperability with other .NET assemblies like System.Data, System.EnterpiseServices, Windows Communication Foundation (WCF) and Windows Presentation Foundation (WPF).


ASP.NET vs ASP

ASP.NET has better language support, a large set of new controls, XML-based components, and better user authentication.
ASP.NET provides increased performance by running compiled code.
ASP.NET code is not fully backward compatible with ASP.

New in ASP.NET

  • Better language support
  • Programmable controls
  • Event-driven programming
  • XML-based components
  • User authentication, with accounts and roles
  • Higher scalability
  • Increased performance - Compiled code
  • Easier configuration and deployment
  • Not fully ASP compatible

Language Support

ASP.NET uses ADO.NET.
ASP.NET supports full Visual Basic, not VBScript.
ASP.NET supports C# (C sharp) and C++.
ASP.NET supports JScript.

ASP.NET Controls

ASP.NET contains a large set of HTML controls. Almost all HTML elements on a page can be defined as ASP.NET control objects that can be controlled by scripts.
ASP.NET also contains a new set of object-oriented input controls, like programmable list-boxes and validation controls.
A new data grid control supports sorting, data paging, and everything you can expect from a dataset control.

Event Aware Controls

All ASP.NET objects on a Web page can expose events that can be processed by ASP.NET code.
Load, Click and Change events handled by code makes coding much simpler and much better organized.

ASP.NET Components

ASP.NET components are heavily based on XML. Like the new AD Rotator, that uses XML to store advertisement information and configuration.

User Authentication

ASP.NET supports form-based user authentication, cookie management, and automatic redirecting of unauthorized logins.

User Accounts and Roles

ASP.NET allows user accounts and roles, to give each user (with a given role) access to different server code and executables.

High Scalability

Much has been done with ASP.NET to provide greater scalability.
Server-to-server communication has been greatly enhanced, making it possible to scale an application over several servers. One example of this is the ability to run XML parsers, XSL transformations and even resource hungry session objects on other servers.

Compiled Code

The first request for an ASP.NET page on the server will compile the ASP.NET code and keep a cached copy in memory. The result of this is greatly increased performance.

Easy Configuration

Configuration of ASP.NET is done with plain text files.
Configuration files can be uploaded or changed while the application is running. No need to restart the server. No more metabase or registry puzzle.

Easy Deployment

No more server-restart to deploy or replace compiled code. ASP.NET simply redirects all new requests to the new code.

Compatibility

ASP.NET is not fully compatible with earlier versions of ASP, so most of the old ASP code will need some changes to run under ASP.NET.
To overcome this problem, ASP.NET uses a new file extension ".aspx". This will make ASP.NET applications able to run side by side with standard ASP applications on the same server.