Thursday, January 20, 2011

Create a Custom HTTP Handler

We know that all ASP.NET requests are mapped to corresponding HTTP handlers based on the file extension requested in the request. Also we have seen couple of HTTP handlers out of the box provided by ASP.NET such as Page handler (.aspx) , Usercontrol handler (.ascx), Webservice handler (.asmx) etc.

In order to build some additional handling functionality, we are requested to build some custom HTTP Handlers. We can implement two types of handlers basically by overriding the respective interfaces. We have IHttpHandler and IHttpAsyncHandler to create custom synchronous and asynchronous handlers respectively. The interfaces require us to implement ProcessRequest method and a property called IsResusable. ProcessRequest method is used to perform the logic to handle the request and IsReusable property can be set to true or false to decide whether to pool the handler for reuse.

Now let’s walk through on the steps required to create a Custom handler

· Create a Class Library Project. (in my case its “MyCustomHTTPHandler”) in Visual Studio 2008/2010.

· Add a class called “MyHandler.cs” and inherit from IHttpHandler. Make sure to add System.Web.dll reference.

· Now implement the method ProcessRequest and IsReusable property as well.

We can add necessary code logic inside the ProcessRequest to perform custom actions. We are now done with the coding. Now we need to add reference in Web.config for the handler under section in IIS 6.0 and in IIS 7.0/7.5. Also we need to configure it in IIS as well.

Here in this example you can add the following entry onto the web.config as follows

<add verb="*" path="*.sample" validate="false" type="MyCustomHTTPHandler.MyHandler"/>

So when a request comes for a resource with .sample extension, this referred handler gets fired.

You can download the source code for this sample from the following location. Click to download

Wednesday, January 19, 2011

Register Custom HTTP Handlers

We comes across scenarios where we need to build Custom HTTP handlers, ASP.NET calls this HTTP Handler in order to serve a specific request for resources that have a particular extension. Registering a HTTP Handler depends with the versions of IIS. All of us might have looked at the Web.config file which contains the sections and .

Let’s walkthrough on registering the handlers in IIS 6.0 & earlier versions and IIS 7 & later versions. Basically section is used for IIS 6.0 settings and is used for IIS 7.0 and later ones. Again for IIS 7.0 we have two different cases as the settings are different for Classic mode as well as integrated mode.

HTTP Handler for IIS 6.0:

We need to add the handler reference under the section under section.

The task is not yet completed yet as you need to configure the same in IIS as well. Here you can see that if a request comes for any file with extension .MyFileExtension , it gets route to the MyFile class placed inside the App_Code folder.

HTTP Handler for IIS 7.0:

The main difference in adding handlers in IIS 7.0 is that you need to add the reference under the section in the config file. Again here we come across two different scenarios as depends how IIS is running in Classic mode or Integrated mode.

Here scriptProcessor refers to the actual path to the aspnet_isapi.dll file.

· If we are running IIS in Classic mode, you need to enter the reference in both sections like and section as well.

· If we are running IIS in Integrated mode, you need just to enter the reference only in section alone. But here you have to place the reference under the section.


Tuesday, January 18, 2011

uCommerce - e Commerce Platform for Umbraco

uCommerce is a fully featured enterprise level e Commerce solution powered with Umbraco content management features. It’s really cool and builds an excellent e Commerce system within short time. It is fully integrated with Umbraco content management system that it helps to create an excellent e commerce solution to the users. We can easily configure the same within Umbraco itself.

uCommerce foundations provide the basis for an e-commerce solution. Each foundation addresses a specific need for providing a full e-commerce solution to your clients. Foundations in the box include a Catalog Foundation, a Transactions Foundation, and an Analytics Foundation.

uCommerce ships in two editions

· Starter Editions

uCommerce Starter Edition is targeted for the smaller shops, which require less flexibility and features out of the box.

· Pro Editions

Pro Edition is targeted at high-end stores, which requires support for support multiple stores, multi currency, differentiated pricing, multiple catalogs, and more.

Following are the excellent features with uCommerce. Let’s have a glance at the same

· Catalog foundation:

As we know that catalog capabilities is a key element for any e Commerce application. Here Catalog foundation handles all tasks related to publishing products to store. It supports most of the features for a e Commerce application out of the box.

· Transaction Foundation:

Transaction foundation handles all tasks from persistent baskets till check out flows. It has full support for all Payment providers.

· Integrated with Membership:

uCommerce is completely integrated with the Umbraco membership system.

· Analytics Foundation:

Analytics foundation provides the features required for implementing an Analytics solution out of the box. It has a rich reporting features out of the box and very easy to add custom ones as well.

· Commerce XSLT Library:

Commerce XSLT library provides an opportunity for Umbraco developer to easily build a user friendly Store sites.

· Foundation API:

uCommerce exhibits the vast functionalities via its rich API set. It helps developers to integrate the API very easily to build nice applications.

If you would like to know more details on uCommerce, please check the website http://www.ucommerce.dk/

Sunday, January 16, 2011

Razor – view engine for ASP.NET

Razor is a new view engine for ASP.NET. We know that view engines are pluggable modules that implement different templates syntax options. We have .aspx/.ascx/.master as the default view engine for ASP.NET MVC. This is optimized around HTML generation using a code-focused templating approach. “Razor” uses a new file suffix “cshtml” or “vbhtml”, where the prefix is the language used in the file.

Razor has the following features

  • Razor minimizes the number of characters in coding which brings a cleaner server side code.
  • Easy to learn and use the existing coding skills
  • Works in any text editor
  • Full intellisense support in Visual Studio 2010

Let’s examine how the new Razor syntax looks like. Following the common server side code snippet

    <% foreach(var student in students) %>

    <%{%>

    <% student.Name %>

    <%}%>

Now we have the following simple Razor syntax as follows.

    @ foreach(var student in students)

    {

    @ student.Name

    }

Hey it gives a clean server side code.

Friday, January 14, 2011

WebMatrix

WebMatrix can be defined as a light weight alternative for Visual Studio. It is actually a free tool released by Microsoft for rapid development of Web applications based on ASP.NET. Initially it was considered as test tool for ASP.NET controls. It was developed using C#.

It’s certain that one can’t say WebMatrix as a total substitute for Visual Studio; rather it can assist in Web development tasks. The main attraction is that it’s a free tool from Microsoft. We can perform all tasks starting from Website development based on available Open source Web apps listed in asp.net gallery to the ones built from scratch. Creating a website is pretty easy to achieve within five minutes. It provides all tools features to assist in Website customization. Publishing process has been made simple with WebMatrix.

Let’s list some of the cool features of WebMatrix as follows

• It’s a simple tool which bundles with Web Server , a database and a programming frameworks onto a single IDE.
• Easy to integrate WebMatrix with Visual Studio when developing larger applications beyond WebMatrix
• Built in publishing support for FTP,FTPS and Web deploy.
• It ships with small, embedded version called SQL Server Compact.
• It has a rich code editor, database editor, web server management ,SEO, FTP publishing etc which provides a elegant user experience.
• Enhanced Code Helpers which simplifies in implementing extra functionalities.
• Easy to start with any of the available Web applications as listed under asp.net app gallery like DNN, Umbraco or WordPress etc.
• Coding made easy. Introduced Razor syntax for ASP.NET pages.
• Intellisense support for HTML ,CSS etc
• WebMatrix integrates with IIS Express. It helps in real time monitoring of Web requests and response.

Thursday, January 13, 2011

Umbraco 4.6 Beta (JUNO )

It’s almost Five years has passed since Umbraco was introduced. Over the years we have visualized different versions of Umbraco and its enhancements each year. Now here comes Umbraco 4.6 Beta aka “JUNO”. It has the following features

•Improved installation experience and getting started process for newbie
•Enhanced Starter kits and dashboard driven help resources
•Introduced Robust Skinning engine which helps to create Umbraco skins
•Additional developer features like the introduction of INode, IMacroEngine and ILog interfaces with a vision of extending Umbraco.
•Updated User control wrapper with support for XML return types
•Support for Microsoft’s Razor syntax
•Support for Microsoft’s SQL CE 4.0 database

Wednesday, January 12, 2011

Visual Studio Test Professional 2010

Visual Studio Test Professional 2010 is an integrated testing toolset from Microsoft which provides a complete plan-test-track workflow for in-context collaboration between testers and developers. We know that the goal of a Software development company would be to maintain optimum quality of the product and maintain high productivity in testing. QA team is a key element of every Software development life cycle. So there always exists a requirement for a good collaborative working environment for QA as well in the company.

As we know Microsoft had started delivering testing related IDEs since 2005 with the Visual Studio Team System. With an enhanced product in mind with rich capabilities, Microsoft has released Visual Studio Team Professional 2010. It has the following features such as

•Align testing efforts to the application lifecycle
Visual Studio Test professional is being integrated with the Team Foundation Server which provides collaborative enhanced environment for testers as well.

•Embrace manual testing
Test professional provides a rich interface for performing manual testing, records each an every step and data used, bugs found. Easy to file from test interface.

•File detailed and actionable bugs
It has a new IntelliTrace feature which helps to file a rich and actionable bugs easily.

•Re-use manual test recordings
With Fast Forward for Manual Testing, you can record test steps in a sequential order, then playback and pause the recording as if you were performing the test steps manually. You can reuse the resulting recording in regression testing of the same test case.

•Improve your test process
Visual Studio Test Professional 2010 helps to create test plans, test suites, and test cases with nesting capabilities, and organize tests in the most effective and logical way. It helps Test leads to begin test planning as early as the architecting and designing stages.

Please browse for download and more details at http://www.microsoft.com/visualstudio/en-us/products/2010-editions/test-professional

Monday, January 10, 2011

SharePoint 2010 – Core functional areas

As we know it’s almost three years have passed with the introduction of SharePoint 2007. Now we have SharePoint 2010 which has been released on May last year. SharePoint 2010 is divided into 6 different core functional areas. Let’s have a glance at the diagram as given below





In SharePoint 2010, we have the above depicted 6 core functional areas. Let’s now jot down briefly on the different points as follows.

• Sites – managing sites.
In SharePoint 2010, they have enhanced the building and managing of internal and external sites. Here they have enhanced the content authoring/editing experiences, multi lingual support for websites, enhanced organizing and categorizing of content, compliance with Web standards , improved search via FAST Search , Web Analytics integration , improved personalization and enhanced cross browser support.

• Communities – enhanced social collaboration
As we know currently a large number of users are focused on Social networking even its been included in work places as well. It’s tough to see users without a Facebook or Twitter account, blogging etc. So we have observed a latest trend that every Software is released with a Social collaboration in mind. So here we have SharePoint 2010, create enhanced user profiles, tools for sharing blogs, wikis, RSS feeds etc, creation of communities, social tagging/book marking etc and enhanced My Sites.
• Content – manage documents/information/records

With SharePoint 2010, they have enhanced the overall content management. For an organization we have mainly two types of contents such as Documents/Information and Records. They have enhanced it to collaborative environment from a mere document storage.

• Search :
SharePoint 2010 has two levels of search: the built in functionality which is greatly improved from SharePoint 2007 and FAST Search, offering additional functionality.

• Insights: focused on Business Intelligence enhancements.
Here SharePoint 2010 comes with enhanced Business intelligence capabilities. Improved Excel services, BDC and integrated Performance Point Server capabilities.

• Composites: integrate business systems
SharePoint 2010 has introduced capabilities for integrating different business systems onto SharePoint, fetch or update data onto different databases from SharePoint platform itself. They have introduced the Business Connectivity Service (BCS).


Execution Model Overview – Windows Phone 7

Windows Phone 7 execution model describes the life cycle of the applications running on Windows Phone from launching an application till its terminations. The aim of designed execution model is that it ensures a fast and responsive experience to the end users. In order to implement this model prioritize the foreground applications and terminates all background applications. Also it provides enhanced user navigation to and forth across the application screens. To implement this seamless navigation Windows phone activates and deactivates the applications dynamically.
When we talk about the Windows Phone execution model, we come across a lot of keywords such as

Tombstoning : Scenario where OS terminates an application when the user navigates away from the application. Here OS maintains the state information.
Page state: This refers to the visual state of the application page.
Application state: The state of the application that is not associated with a specific page.
Persistent data: Data that is shared by all instances of an application.
Transient state: Data that represents a single instance of an application.

Now let’s walk through on the life cycle of an application, All events related to the life cycle of a Windows Phone Application are members of the PhoneApplicationService class. We have the following events.

Launching:
An application is said to be launched when the user starts by taping the Start button and not by hitting the back button to return to a previously started application. Here a new instance of an application is started. Launching event is raised.

Running:
After the Launching event is handled, an application starts running. While an application is in this state, it manages its own state as the user navigates through the application’s pages.

Closing:
One possibility is that the user presses the hardware Back button to navigate backwards through the pages of the application, past the application’s first page. When this occurs, the Closing event is raised and the application is terminated.

Deactivating:
This state is reached when a running application is replaced in foreground by a another application, then the first application will get deactivated.

Activating:
When the user returns to a tombstoned application, it is reactivated and the Activated event is raised. In this event, an application can read values from the State dictionary in the PhoneApplicationService class to reestablish the state of the application that the user experienced before the application was deactivated.

Sunday, January 9, 2011

Silverlight or XNA framework: Windows Phone

When you begin developing Windows Phone applications, you need to choose a framework one from Silverlight or XNA framework. Let’s list down a comparison based on different scenarios which can help one to differentiate on what to choose.

Silverlight

XNA

XAML based event driven application framework

High performance game framework

Create a rapid , rich internet application – UI has more importance

Multi screen 2D and 3D games

You need to use Windows Phone controls

You want to manage art assets such as models, meshes, sprites, textures, effects, terrains, or animations in the XNA Content Pipeline.

Embed video inside your application

Use HTML web browser control

.NET Framework Class Library for Silverlight contains a comprehensive list of classes, interfaces, and value types that are included in Silverlight. It also contains a list of Silverlight features that are supported in Windows Phone. XNA Framework Class Library contains a list of classes, interfaces, and value types that are included in XNA Game Studio.

Saturday, January 8, 2011

Windows Phone – Application platform

Windows phone application platform helps to develop interactive consumer applications in Windows phones. The major attraction over here is that you can use existing Microsoft tools and technologies such as Visual studio, expression blend, Silverlight and XNA framework.

Here we have two frameworks for developing applications on Windows phone such as

• Silverlight framework for event driven , XAML based application development
• XNA framework for fun gaming and entertainment experiences

The Windows Phone Application Platform helps developers to create applications by providing:

• A familiar and inexpensive toolset.
• A cohesive and well designed managed API set.
• An isolated sandbox for each application.
• Runtime services on devices that can be used to access web services in the cloud such as Xbox LIVE®, Windows Azure, location, and notification services. Access to 3rd party Windows Communication Foundation (WCF) and Representational State Transfer (REST) services across the web is also supported.
• The Windows Phone Marketplace to distribute their application.

Friday, January 7, 2011

Windows Phone 7 – Mobile OS

Now I feel that I should start writing something on Windows Phone 7 being a techie working on Microsoft products. Recently I have started learning Android, so thought I should not miss WP7 as well.
Windows Phone 7 is the latest version of Windows Mobile Operating System developed by Microsoft which is a successor to its Windows Mobile Platform. Windows Phone 7 is a rebranding of Microsoft’s old mobile OS called Windows Mobile. Before the official announcement of Windows Phone 7, Microsoft began to refer to devices running Windows Mobile as “Windows Phones”.

Let’s list the features of WP7 as follows

• Windows Phone has a new user interface code named as “Metro”. The home screen (called the "Start screen") is made up of "tiles", which by default are links to important features, such as phone, music and videos, email, office, and contacts.

• Enhanced virtual keyboard

• Internet Explorer on Windows Phone 7 allows the user to maintain a list of favorite web pages and show a tile linking to a web page on the Start screen. The browser supports up to 6 tabs, which can all load in parallel.

• Contacts are organized via “people hub”

• Setup support Hotmail, Outlook, Yahoo! Mail, Gmail, and other email services and also features support for POP and IMAP accounts.

• Zune for Windows Phone 7 is an application providing entertainment and synchronization capabilities between PC and Phone. Xbox Live on Windows Phone 7 brings Console-like gaming experience to phones by displaying the user's avatar in a 3D fashion. Via "Games Hub", the users are able to interact with the avatar, view gamer score and leader boards, message Xbox Live friends, and Spotlight.

• Bing Maps on Windows Phone 7 provides satellite imagery and real-time traffic information and also generates directions between two point locations and well as from the current location.

• The "Office hub" organized all Microsoft Office programs and documents. Microsoft Office Mobile provides operability between Windows Phone 7 and the desktop version of Microsoft Office.

Software and OS updates in Windows Phone 7 will be delivered to Windows Phone users via Microsoft Update, as they are for desktop Windows users. The software component, called Windows Phone Update, exists both on the phone (for smaller updates, over-the-air) and in the Zune PC software (for larger updates, via USB connection).
Windows Phone 7 applications will be based on Silverlight, XNA and .NET Compact Framework. Windows Phone 7 will only run applications that have first been approved by Microsoft and made available via the Windows Phone Marketplace.

But still we have few limitations for WP7 such as does not support copy or paste / multi tasking for 3rd party applications etc.

Wednesday, January 5, 2011

XSLT in Umbraco

We have already described the content delivery model in Umbraco in my earlier post. So now let’s see how XSLT is used to created html out of the generated Umbraco XML content. In Umbraco the XML is generated based on the Document type alias and properties type alias.



This is a Sample XML generated (based on the Runway package). Here you can see the XML nodes created based on the RunwayHomepage and RunwayTextpage Document types. Also you can see the corresponding properties alias like bodyText, siteName , siteDescription etc.

I have already defined XSLT in my earlier post. It’s very easy to create an XSLT in Umbraco. Just follow the steps given

• Go to developer section
• Right click XSLT
• Create – file name and choose a template
• You are done

Following are the benefits of XSLT out of the box in Umbraco
• Insanely fast compiled code
• Easy to edit
• Caching is free
• Flexible and reusable
• Generates nice (x)html
• Easy to extend and ships with helpful libraries
An empty XSLT file created out of the box in Umbraco looks like as follows



You can write the code logic inside the marked section in the above code. You can use for each , if else , Umbraco libraries etc inside the XSLT to implement a functionality.
Please feel free to watch a good video demonstration in the following url http://umbraco.org/help-and-support/video-tutorials/umbraco-fundamentals/xslt-in-umbraco-45/xslt-and-umbraco

Tuesday, January 4, 2011

XSLT - Transformation example

In my previous I have briefed about XSLT. Now let’s walk through how XSLT transformation is being done.
Let’s consider the following XML document. Here I have created a Company.XML as follows



Now we need to create an XSL style sheet as follows Company.xsl



Now we need to link the XSL style sheet with the XML document as follows.



If we have an XSL compliant browser, we can nicely transform XML document into XHTML. So here we have the output as follows

XSLT

XSL stands for EXtensible Stylesheet Language which is a style sheet language for XML documents. XSLT stands for XSL transformations. When we talk about XSLT, we come across the key words XML and XPath. Basically XSLT is a language for transforming XML documents into XHTML documents or other XML documents. XSLT uses XPath to find information in XML documents.

XSLT transforms a source XML document into another type of document type recognized by browsers like HTML or XHTML. With XSLT you can add/remove elements and attributes to or from the output file. You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more.

XSLT uses XPath to navigate through the documents to find the information. During transformation process, XSLT uses XPath to define parts of source document to match one or more predefined templates. Once a match is found it transforms the selected section onto a result document. All major browsers supports XML and XSLT.

Monday, January 3, 2011

Templates in Umbraco

In my earlier post I have briefed on Umbraco document types. Now it’s the time to write down about Templates in Umbraco. Umbraco template is basically a text/(X)Html combined with Umbraco tags.

Umbraco templates has the following functionalities such as
• Inserting property from the current page
• Inserting macros/dynamic content
• Manage the central layout of the site

Templates can be created from the Settings section in Umbraco administration. Also corresponding templates are created when a new Document type is created. We can associate a template with a Document type.

Document Type in Umbraco

Document type is a key element of Umbraco. It defines the properties, templates and hierarchy to be used for the content elements. The architecture of Umbraco does not allow creating a content element without a document type.

Document types define the fields to enter data. These fields are called properties in Umbraco. Properties have metadata. The items in the metadata include Name, Alias, Type and Tab. Name refers to a user friendly name of the property. Alias refers to the text used by Umbraco in GET_ITEM calls. Type refers to Data type in Umbraco. Tabs are used to organize document properties. Tabs hold only a single metadata called Name which is used to identify the tab.

Structure tab is the place where we can control the hierarchy of the site. Info tab is the first tab on a document type. This represents the display options for the document type. Info tab has got the following metadata items such as Name, Alias, Icon, Thumbnail, Description, Allowed templates and Default template. Name refers to a user friendly name of the document type. Alias is a text used by Umbraco. Icon is the image displayed in the content tree. Thumbnail refers to a large image that shows on the Create Page dialog. Description holds the information about the document type. An allowed template allows managing the templates associated with this document type.

Next I will jot down a brief introduction to templates in Umbraco.

Sunday, January 2, 2011

Umbraco – XML Schema

Let’s jot down the importance of XML schema in Umbraco. As I have posted earlier Umbraco is a most flexible open source CMS based on .NET technology. Let’s discuss on an overview of how Umbraco works with the content.




Here the whole content gets stored in Database. Every time a new document is created or edited, the data gets stored in database in normal tables. Here comes the publishing logic which is entirely different from the create/edit logic. Publishing process fetches the content from the database and generates the XML out of it.
Here the publishing logic performs two actions such as
• Stores the data as XML in database itself for easy access
• Stores the data in a physical file called umbraco.config under App_Data folder in Umbraco root and finally places the data onto XML cache which helps to increase the performance.
Every time a request comes to the website, instead of going to the database, fetches the data directly from the XML cache. This increases the overall performance of the website. Umbraco relies on its document types and its properties to generate the corresponding XML.
Keep watching for Document types in my next blog.

Umbraco – an Open Source CMS

Recently I had a number of chances to work with the most popular Umbraco CMS, so I planned to pen down an introduction to the most flexible CMS. Umbraco is a leading .NET based open source content management system platform for publishing content on the web.
Basically it’s written in C# and deployed on Microsoft infrastructure, stores the data in a number of relational databases like SQL Server. Umbraco is typically deployed in IIS. Umbraco is built upon Microsoft’s .NET Framework, Microsoft SQL Server and XSLT (it’s an XML based language for transformation of XML documents). This is designed in such a way that it supports a high level of flexibility in customization, easy to integrate the existing technologies with lesser effort. We can use ASP.NET user controls, master pages, Membership role providers etc with Umbraco.
Upon working with this CMS in couple of projects, I can say that it’s a very simple and flexible CMS which can cater to the needs of content editors, developers and designers individually. It’s very easy to set up and run an Umbraco installation, step by step installation notes have been provided in the Umbraco site. The major advantage which I felt was rapid Web site development, content editors, designers and developers can work in parallel which can ensure a rapid delivery of the project. Microsoft has stated Umbraco as one among the top five popular downloads via Microsoft Web platform installer.
Do check the Umbraco site for more information http://umbraco.org/ . Keep watching my blog on more posts in Umbraco.

Installing ASP.NET MVC

Installing ASP.NET MVC Before we dive deep into the ASP.NET MVC, let’s install it our development machine. This is very straight forwa...