ASP.NET Web Matrix is a free, lightweight, easy-to-use Microsoft tool for developing ASP.NET Web applications. Web administrators can use the tool to build Web sitemanagement applications, such as a Web application that lets you remotely monitor the health of your IIS Web farm. The Microsoft .NET Framework and ASP.NET Web Matrix make building Active Server Pages (ASP) applications significantly easier than other Microsoft tools do. If you've never tried ASP.NET, ASP.NET Web Matrix is a good place to start, with its WYSIWYG Web form designer, a set of tutorials, and links to the active ASP.NET community.
Getting and Installing ASP.NET Web Matrix
ASP.NET Web Matrix is a robust Web application builder with a variety of features, which Table 1 lists. You can download the 1.2MB ASP.NET Web Matrix at http://www.asp.net/webmatrix/download.aspx?tabindex=4. ASP.NET Web Matrix requires the .NET Framework and guides you through that tool's installation if necessary. (Note that ASP.NET Web Matrix also requires Microsoft Internet ExplorerIE5.5 or later.) Links to download Microsoft Data Engine (MSDEthe free runtime version of Microsoft SQL Server) and Microsoft Mobile Internet Toolkit are also available on the ASP.NET Web Matrix download page. If you don't have SQL Server, you'll want to download and install MSDE so that you can build dynamic, data-driven applications.
After you download ASP.NET Web Matrix, installing it is simple. Double-click the webmatrix.msi file to execute the installation wizard. Agree to the free license and click Next a few times to move through the wizard. You have a choice of where to install ASP.NET Web Matrix, which requires 2565KB of drive space. Click Install to proceed with the installation and Finish to complete the installation.
ASP.NET Web Matrix Introduction
To run ASP.NET Web Matrix, click Start, All Programs, Microsoft ASP.NET Web Matrix. The program group includes ASP.NET Web Matrix, its documentation, and a .NET Framework ClassBrowser designed specifically for ASP.NET Web Matrix. The first time you launch ASP.NET Web Matrix, you see the Add New File dialog box. Click Cancel to close that dialog box, which you won't need until you build your first application.
Let's take a tour of the ASP.NET Web Matrix IDE, which Figure 1 shows. Across the top are the menu bar and standard toolbar. On the left is the Toolbox, a panel that contains a set of controls and tools that you can use while designing your Web application. The items available from the Toolbox are context sensitive and change depending on the view you're using.
The document window is the main work area in the middle of the IDE. ASP.NET Web Matrix dynamically creates the document window when you open or create a file. You use the view tabsDesign, HTML, Code, and Allat the bottom of the document window to move from one view of your application to another.
The Workspace window, on the top right, provides an organized view of your file system and open files (in the Works view) or MSDE and SQL Server data sources (in the Data view). In the Properties window, on the bottom right, you can see and edit the state, behavior, and appearance of an ASP.NET page, document, or control.
Building Your First ASP.NET Web Application
With ASP.NET Web Matrix running, select File, New to launch the Add New File dialog box, which Figure 2, page 8, shows. By default, ASP.NET Web Matrix creates an ASP.NET page, which is the file type that you want. Choose a logical location on a local drive to which to aggregate Web content, and give your new page a name. I created a folder called WebMatrix on my notebook and named my file TimTest.aspx. Make sure that the default programming language Visual Basic .NET is selected, and click OK.
ASP.NET Web Matrix creates the .aspx file for you and opens it in the document window in the Design view. My favorite feature of ASP.NET Web Matrix (and Visual Studio .NET, for that matter) is that it generates HTML for you. I'm not a big fan of HTML. Because HTML was never designed for the contortions we put it through in Web applications, writing it manually can be frustrating. So, I appreciate the ability to perform a couple of drag-and-drop operations to create a simple but functional Web application.
First, drag a Calendar control from the Toolbox's Web Controls section to the document window. Press Enter to go to the next line under the Calendar control. Drag a Label control (not visible in Figure 1) to the document window. Your document window should now look like the one in Figure 1.
Click the Label control in the document window, go to the Properties window, and delete the word Label in the Text property. Click the HTML tab at the bottom of the document window to view the HTML code that ASP.NET Web Matrix generated as a result of the two drag-and-drop operations. To modify the page, you can directly edit the HTML code in the HTML tab or All tab, or you can make changes in the Design tab.