Introducing ASP.NET Web Matrixby Wei-Meng Lee & Brian Jepson
Back in the days of ASP 2.0 and 3.0, developers generally had two choices when it came to building Web applications. One was to use Visual InterDev, which came with Visual Studio 6.0. Another was to code everything by hand using a text editor. I didn't really have much experience using the former, as it didn't give me a good impression. Moreover, I had heard a lot of developers complain about its shortcomings. My choice then was to use a text editor (NotePad was a favorite, since it was free, but if I needed to edit big files, I would use an enhanced editor like UltraEdit or EditPad) to write ASP applications. Students who attended my Web development classes often asked the reason for not using a visual tool like Visual InterDev. My usual response was that coding everything by hand allows you to fine-tune the Web pages you are creating. Moreover, it really forces you to have a good understanding of HTML and the underlying ASP object models.
During the early days of the .NET Framework (during the beta 1
era), I still insisted on creating my Web applications using a
text editor. If you were like me, you may remember that you
needed to add the
runat attribute to all of those
<asp:> tags. The
most popular example at that time was a demonstration of the
ability of ASP.NET to automatically maintain the state of a Web
application -- you chose something from a drop-down list box and
click on a submit button, and voila! The selected item still
remained selected! As you built more sophisticated applications,
you realized that you could no longer code that quickly using
just a text editor. How do you know whether a particular object
has this property or method and whether is the method
Visual Studio .NET Comes to the Rescue
Fortunately, Microsoft realized this problem and built a very useful tool known as Visual Studio .NET. In fact, building solid development tools has always been Microsoft's forte. Visual Studio .NET presents an integrated approach to developing .NET applications. Unlike its predecessor, Visual Studio .NET integrates the entire development environment into one. You can now build Windows applications, Web applications, Web services, Windows services, etc., using C#, VB.NET, and all supported languages, in one development environment.
The most significant innovation made by Microsoft, in my opinion, is Intellisense. It greatly simplifies the development process and significantly reduces the memory needed to work with the huge class library in .NET. Can't be sure if a property belongs to a particular object? What is the return type of a method? Intellisense will tell you straight away. For those hardcore programmers who eat the class library for breakfast, I know you can survive without Intellisense (see Brian Jepson's article "You Can Hack .NET Without Buying Visual Studio .NET"). But for the rest of us, Intellisense is a great help! (See Jose Mojica's Article "The Role of the IDE in Programming Languages.")
Though VS.NET speeds the development process, not everyone can afford it (though I think any .NET developer worth their salt should get a copy nevertheless). This issue has been slowing the adopting of .NET, to a certain extent, and Microsoft is well aware of this problem. Hence, Microsoft recently announced the launch of a new tool for building ASP.NET Web applications: the ASP.NET Web Matrix -- a community-supported, easy-to-use development tool for building Web applications. The ASP.NET Web Matrix is positioned somewhere between Visual Studio .NET and plain text editors. It is targeted at developers who are currently hand-coding their ASP.NET Web applications, by providing them with a useful tool to accelerate the development process. It is also used as bait to get new developers to try out ASP.NET. In this article, I will take a look at the capabilities of ASP.NET Web Matrix.
A Quick Tour of ASP.NET Web Matrix
You can download the ASP.NET Web Matrix from asp.net. This tool is very lightweight -- the download is a measly 1.1 MB, small enough to fit on a diskette and petite enough to run on your 128 MB (RAM) Pentium III. The package contains three main components:
- A Class Browser that lists all of the classes in the Base Class Library, including their methods, properties, events, etc. (See Figure 1.)
- The Web Matrix Editor, a visual editor that allows you to build ASP.NET applications using familiar drag-and-drop techniques.
- A lightweight Web server for testing your Web applications.
When you first launch ASP.NET Web Matrix, you will see the Add New File window (Figure 2):
Under the Templates category, you have the following sections:
- General templates for creating ASP.NET Web Forms, ASP.NET User controls, Classes, XML Schema, etc.
- Data Pages: Templates for data-aware Web Forms using the DataGrid control and databinding.
- Mobile Pages: Templates for creating mobile applications (requires the Microsoft Mobile Internet Toolkit).
- Output Caching: Templates for ASP.NET Web Forms that employ caching to improve performance.
- Security: Templates for creating simple login and logout Web pages.
- Web Services: Templates for creating Web services.
We will now run through some of the features of ASP.NET Web Matrix by building two sample Web applications.