Microsoft surprised the IT community by making ASP.NET and the C# compiler/specification freely available. Now, a free Web design tool called ASP.NET Web Matrix is available as well. The tool is a watered-down version of Visual Studio .NET that supports basic ASP.NET coding for simpler Web applications. Let’s take a look at this recently released software and see just what it can do.

Where can I get it?
You can download ASP.NET Web Matrix from the ASP.NET Web site, which has a short registration process. The software is closely integrated with the ASP.NET site, and good support is available. The senior ASP.NET specialists hang out in the online forums. They can assist with installation and running Web Matrix, as well as with ASP.NET.

What can it do?
Primarily, Web Matrix is good at writing ASP.NET Web pages. Figure A shows the Web Matrix environment. Open up Web Matrix after installation, and it will suggest that you create a new file (see Figure B). Next, you can build a Web form. You have the option of viewing the page in design view, HTML, code, or HTML and code together.

Figure A
ASP.NET Web Matrix environment

Figure B
Create a new Web Matrix file.

Web Matrix doesn’t use the codebehind model you might be accustomed to from Visual Studio. Instead, all script is inline, as ASP Classic was. In design view, you can move a TextBox into the viewer and double-click on it. The viewer changes to code view, and you have the option to edit the TextChanged event handler of the box. Change to the All view, and you’ll see that the event handler is within a <SCRIPT RUNAT=”server”> block. Because of this, the code isn’t compiled into a DLL, so there is no need for a build process. Also, Web Matrix has its own Web server—the Web Matrix Server—running on port 8080.

Use databinding with server controls
Databinding is made easy with Web Matrix. Need a dataset? No problem. Change to code view and drag the SELECT Data Method to the screen. A nice wizard walks you though selection of a database and some fields (for this example, a list of customers), and then it generates a function to call to get the dataset, as shown in Listing A.

This dataset can be databound to a datagrid just as normal. Back in design view, you can drag a datagrid on the screen, and three lines of custom code will bind the grid to the new dataset:
Dim dataSet As System.Data.DataSet = MyQueryMethod()DataSet1.DataSource = dataSetDataSet1.DataBind()

Manage SQL Server databases
The Data tab is in the same panel as the workspace. Click the Connection icon (the one that looks like a tin can with a tail). After walking through a similar connection wizard as above, you’ll get the view and edit tables and stored procedures that are related to this database. This is just another hint that Microsoft wants developers to get away from developing with Access and start using SQL Server.

Create Mobile Web applications, and more
If you click the New File button in the upper-left corner, you’ll see that there are quite a number of file types, all of which will give you a good start developing specific kinds of solutions:

  • ·        Web forms
  • ·        Web user controls
  • ·        HTML pages
  • ·        XML Web services
  • ·        Class files
  • ·        Style sheets
  • ·        Configuration files
  • ·        XML FILES, including schemas
  • ·        Custom HTTP handlers
  • ·        SQL files
  • ·        Plain text

And that’s just a rundown of the basic category of pages. There are additional categories, including:

  • ·        Data pages—Templates for often used Web forms
  • ·        Mobile pages—Including forms and user controls
  • ·        Output caching
  • ·        Security—Log in and out
  • ·        Web services—Advanced concepts in Web services

So how is that different from Visual Studio .NET?
Visual Studio is a team enterprise tool. It’s made to use SourceSafe, and it speaks in terms of Projects. ASP.NET Web Matrix is a file editor. It has no concept of a project.

Functionally, for most Web developers, this isn’t much of a difference. If the files are accessible via a share, they are accessible to either software product. But all of those things you think of when you think project—like database connections, project-level tasks, and the like—aren’t quite the same in a file-based system.

ASP.NET code is implemented as inline rather than in a codebehind file
In Visual Studio, the normal placement of server-side script code is in a separate file, called filename.aspx.cs or filename.aspx.vb. These files are compiled to a project-level DLL that is referenced invisibly by the Web server.

In Web Matrix, the server-side code is, as mentioned above, referenced inside the ASPX file in which it is used. This reduces scalability while improving simplicity. Since the goal of Web Matrix is to increase simplicity for those who need more basic services from the ASP.NET framework, this is a good move.

The command line compiler must be used to compile class files
Although you can code DLLs, or class files, using Web Matrix, you can’t compile them in the environment. Because the inline script doesn’t require compilation, there was no need to add compile functionality to the software. This adds significantly to the simplicity, so I applaud the decision.

To compile a class file, you must use the command-line compiler, which isn’t as hard as it sounds. To compile a VB or C# file into a DLL, you just use the appropriate compiler command:
vbc /target:library File.vbcsc /target:library File.cs

Visual Studio is a comprehensive tool; ASP.NET Web Matrix is just for the Web
VS.Net includes many features that Web Matrix doesn’t, but that is to be expected in a free tool. For instance, IntelliSense isn’t implemented. You can’t write Windows Forms at all or use the .NET Mobile Framework to write Mobile Windows Forms. There are no enterprise features, such as Server Explorer, Task List, or SourceSafe implementation. The options for coding style are practically nonexistent. There is no automation. The list goes on.

On the other hand, VS.Net costs $1,000 and is a massive install. If all you need to do is add a response form to a Web site, this is the tool to do it, without a doubt.

Some final thoughts
Microsoft’s development environment has been a confusing mess since Visual Basic Version 2. In the Internet age, the InterDev tools became known as NotePad++ because the active elements were so immature. Tools like Macromedia’s UltraDev were looking like much more realistic tools for coding in the advanced version of Windows DNA. And when the massive Visual Studio .NET went on the market, it seemed that the same would be true for simple programming in .NET.

ASP.NET Web Matrix may change that. With its tightly coded, simple design—and the price tag—it has the potential to make life much easier for a number of Web site programmers and Webmasters in the real world. Download it and give it a try. At 1.2 megabytes and zero dollars, you don’t have much to lose.