WebMatrix is a web development platform from Microsoft aimed at providing a fast and lightweight way to develop dynamic web content. The WebMatrix platform consists of many individual component parts that go together to create a complete web development environment. Throughout the course of this book you will learn about each of these component parts in some detail.
This chapter is not concerned with the inner-workings of the platform or its individual components, but is focused on explaining the landscape in which WebMatrix exists. It will aim to explain the intent behind the design of WebMatrix and the problems it sets out to solve.
WebMatrix is a set of free development tools that designed to allow users to easily create dynamic, data-driven web sites and publish them on the Internet.
The tools and technologies included as part of the WebMatrix platform include among others, a database, web server, deployment tool, Search Engine Optimization (SEO) tool and a server-side scripting language. Although all of these tools and technologies are available for download and use as separate entities, Microsoft has combined them into a single stack known as WebMatrix. By doing this a web developer can control the development of all aspects of a web site from within a single environment, greatly reducing complexity. This reduction in complexity realizes many benefits, not least of which are the shortening of development times and a greatly reduced entry barrier – the developer must learn to use just one integrated environment, rather than five or six separate tools.
To further reduce the learning curve, many of the component parts are simplified when presented as part of WebMatrix. For example, the web server supplied by Microsoft as part of WebMatrix is a smaller, development-friendly version of their full-blown Internet Information Services web server application and the database is the Compact Edition of SQL Server, their enterprise-level relational database server. This is a great advantage to new developers. WebMatrix presents you only with what you absolutely need to create web sites, cutting away the myriad of features that are used rarely, often only by advanced users.
To the more advanced developer this simplification of the development environment can be a refreshing change, especially with the current trend of huge monolithic web development frameworks and architectures. You can after all still access the component parts through their native tools should the need arise.
What WebMatrix offers above all else is simplicity, ease of use and rapid development.
So far we have learnt that Microsoft WebMatrix is a great tool for creating “dynamic, data-driven web sites”, but what exactly does that mean? Well let’s take the dynamic bit first.
In simple terms website content can be provided in one of two ways. The first, more traditional way is to store the content in static files like documents and serve them whole to the client browser. If you were to take each page of this book and store it as an HTML page which was displayed back to the user in its entirety when they requested it, you would be providing static content. A static web page retrieved by different users at different times will always be displayed in exactly the same way.
A dynamic page is one that freshly produces at least some of its content programmatically when a request is made to the web server. In other words, when a user requests a page from the web server some code is run which is used to construct the output to be returned to the user. This dynamic creation of content is the polar opposite of the traditional static website. WebMatrix uses ASP.NET Web Pages to execute C# or Visual Basic .NET code on the server to create dynamic content.
Dynamic pages can also be used to accept input from users, which is then used for some kind of computation. For example, a page may request a monetary value in one currency, which is then converted to another currency on the server and the result displayed back to the user.
Data-driven pages are those that interact with some kind of data store. For example, input from the user may be used to create or update database records or data may be retrieved from an XML file and formatted by code for output. By using the data stores in database tables and records we are able to produce custom page content, whether on a user-by-user or some other basis.
The typical database operations conducted by web pages are Create, Read, Update and Delete, typically abbreviated as CRUD. We can produce user interfaces and server-side code which will allow site users to carry out these operations on the database in a very controlled fashion.
In reality most web pages produced by WebMatrix, or any of the other server-side dynamic frameworks such as PHP or Ruby on Rails, are a mix of static and dynamic content. This is done primarily for two reasons; speed and simplicity.
It is much simpler for a developer to create static content and it is quicker to produce and serve. Therefore it is common practice to mix the two techniques within a single page, returning dynamic, data-driven content only where necessary, amongst the rest of the static markup.
Figure 1-1 demonstrates this concept by identifying the areas of static and dynamic content on a typical page from the example ecommerce web site, “TechieTogs” that we will design and build in chapters 9, 10 and 11. Content that has been created dynamically in code is highlighted; the rest of the page is constructed using static HTML:
There are many great web frameworks available for developing dynamic sites, why should you choose to use WebMatrix? Well it has a lot of advantages; let’s have a look at a few of the major benefits here:
We have mentioned that WebMatrix uses ASP.NET Web Pages to create dynamic content by executing code on the web server. ASP.NET Web Pages is the latest addition to the ASP.NET platform, which has been around since 2002. As a result the designers of the ASP.NET Web Pages platform have been able to draw on vast experience, gained over nearly a decade, to design a lightweight and fully-functional web development platform. In designing WebMatrix, Microsoft have really listened to the users in the ASP.NET and wider web-development communities, many of whom have been asking for the power of .NET and its associated libraries and infrastructure in a platform which allows simple rapid-development, ease of use, extensibility and total control over the output sent to users.
The Trend Towards Simplicity
Figure 1-2 shows how ASP.NET Web Pages fits into the ASP.NET technology stack:
From this diagram it is clear to see that ASP.NET Web Pages is built on top of ASP.NET in the same way as ASP.NET Web Forms and ASP.NET MVC (Model View Controller). ASP.NET is in turn built on the .NET Framework. This architecture means that ASP.NET Web Pages can take full advantage of the huge .NET Class libraries which exist to enable developers to perform a wide variety of common programming tasks, which would otherwise be cumbersome, complex and time-consuming.
The other advantage that becomes apparent from the architecture is that the transition for .NET developers from one platform to another is relatively straightforward. A .NET developer will have many transferable skills between the various web, desktop and mobile development frameworks, due to the fact that they are all built on the .NET Framework with which they are already familiar.
WebMatrix is absolutely ideal for anyone wishing to create a small to medium-sized dynamic, data-driven site for deployment on a Microsoft Windows web server. Examples of people who may find WebMatrix useful include:
This is by no means an exhaustive list, but does go some way to demonstrate the diverse groups of people who could benefit from this platform. This book is aimed at all of these groups and assumes no previous knowledge other than a basic understanding of HTML and Cascading Style Sheets (CSS), although some previous programming experience, however minimal, will certainly be of benefit.
Over the course of the book you will learn everything you need to create fully-functional, dynamic, data-driven websites; a fact that will be proved in chapters 9, 10 and 11 when we use the skills and techniques learnt in the first part of the book to develop a fully-working ecommerce web site.
The following list describes some of the major topics covered in the text:
WebMatrix has an active and vibrant on-line community, made up of a wide range of beginners, students, hobbyists and professional developers, where new members are always warmly welcomed. There are several excellent on-line forums available, which are a good place to ask any questions you may have; these include:
Tip Please remember to follow normal forum etiquette by always using the forum’s search facility to see if your question has been asked previously by another user before you post.
I would also recommend that you visit the following sites regularly to keep yourself up-to-date with developments in WebMatrix as well as details of future releases, updates and events:
Finally, there are a number of experts whose blogs who I would recommend to any WebMatrix developer. Here I have listed a few interesting articles:
There are some personal and hardware requirements which you must be able to meet before you can progress through this book.
You will be able to complete and understand all the chapters in this book as long as you have a basic working knowledge of HTML and CSS. However, some previous programming experience of any kind and a general working knowledge of internet technologies would be of benefit.
Links and references to useful web pages and publications are provided throughout the text to help you read around the subject and really gain a full in-depth knowledge of the concepts discussed.
To install and use WebMatrix you must have a PC running one of the following supported Microsoft Operating Systems:
In this chapter you have had a brief overview of WebMatrix, what it can do and why it has become so incredibly popular with beginners and experts alike. Now I’ve whetted your appetite let’s move on to the next chapter where we dive straight in by installing WebMatrix and writing our first web application.
Good luck!