Why Get Caught in .NET?
Before we dive into exploring the new IDE, let's take a second to review the reasons .NET may be in your future. .NET may mean different things to different people, but to me, the answer to the "why?" question is XML Web Services. The industry is rapidly converging on XML Web Services as the means to add meaningful communications to networked applications. For an overview of why this is happening, see "Is Your Company Ready for the Web Services Revolution?" Although anyone can participate in the XML Web Services world, there are two main camps forming for the creation and delivery of applications that integrate XML Web Services: the Java consortium's camp (BEA, IBM/WebSphere, Sun, Apache, etc.) and Microsoft's .NET camp.
So what does Microsoft tout as some of the advantages of its .NET platform? It is, of course, more than just a means of developing and deploying XML Web Services, although this is a major goal. In addition, you can use it to develop and deploy applications to browser-based clients, Windows clients, and mobile device clients. Another aim is to simplify the application environment by eliminating some of the problems that have plagued Windows applications, such as version conflicts. For example, "XCOPY deploy" is a big new feature, promising to free us from "DLL hell" by being more granular in the runtime library selection and by allowing different versions of the same components to be used by different applications at the same time. .NET also touts programming language independence because of the Common Language Runtime (CLR), a framework that, among other things, performs memory management and allows objects created in different programming languages to communicate with each other. For more information from Microsoft on the benefits of .NET, go to the .NET site.
ASP.NET Web Matrix
ASP.NET Web Matrix is a new IDE from Microsoft that makes it easy to create and deploy ASP.NET pages and other file types as well. Web Matrix is a great way to get started in .NET, because it's free (download Web Matrix) and provides everything you'd need, including an IDE and a Web server. You can also optionally download Microsoft Data Engine (MSDE), a free desktop database compatible with SQL Server. So, once you have the base OS, it's all free, and that's a good thing. Web Matrix itself is a small download (1.2 MB), but if you don't already have one of them, you'll also need to download and install the .NET SDK or the .NET runtime (it can use either), which are quite a bit larger, at 20 MB and 100+ MB, respectively. Note that you must be on Windows 2000 or higher to use Web Matrix.
As you are probably aware, Active Server Pages (ASPs) are server-side programmable Web pages, similar to JavaServer Pages (JSPs). Just as Visual Basic.NET is the .NET version of VB, ASP.NET (.ASPX) is the .NET version of ASP. ASP pages are typically served from Microsoft's Internet Information Server (IIS) Web server. Prior to the introduction of ASP.NET Web Matrix, IIS was a prerequisite for developing ASP pages, which meant that if you didn't already have IIS installed and configured either locally or on a server somewhere, you had to do that first. However, Web Matrix includes a local Web server that eliminates the IIS requirement (although it will work directly with IIS as well), which removes a big obstacle for non-IIS installations.
Web Matrix is a "technology preview," which means that it's not entirely ready for prime time. However, don't let that stop you from checking it out, as it's quite complete and very usable. After going through the Guided Tour, my initial impressions are that it's like VB for the Web. You drag and drop controls onto forms, visually set properties for them, add your own code where necessary to handle events, and click the Run button to instantly see the results. Nice! If you're familiar with VB development and Web technologies, you should feel pretty comfortable.
As you can see from the screen shot in Figure 1, Web Matrix consists of several key elements, including a WYSIWYG HTML editor, a control toolbox, HTML and code editors, database connectivity and management functionality, and visual component property management.
Figure 1: The Design Mode allows you to visually lay out Web pages. (Click images to enlarge.)
Web Matrix provides support for many different types of files, including straight HTML pages, many different templates for ASP.NET pages, and XML files. One of the nicest things about it is that it's file-based rather than project-based, meaning that you can simply point to the files you want to work on and bring them into the editor quickly. Of course, if you're going to be doing serious development work, you'll want to use Web Matrix's big brother, Visual Studio .NET, which has better support for projects and version control.
The number of templates that it provides is impressive. When you create a new file, you can select a template upon which to base the file. The templates are organized into categories. Figure 2 shows all the items in the General category, and Figure 3 shows the items in the Data Pages category. As you can see, there are a lot of templates provided to give you a framework for creating these common page types.
Figure 2: The General templates include a number of common file types.
Figure 3: The Data Pages templates provide frequently used database page types.
In addition to the template support, Web Matrix also provides support for server-side Web controls, such as the calendar shown in Figure 1. Server-side Web controls are very powerful because they run on the server and generate standard HTML that can be read in browsers like IE, NS, and Opera. When adding Web controls, you can connect to an online gallery that will let you download controls from a central repository on the ASP.NET Web site. As you can see from the screen in Figure 4, the category list is extensive. However, there are presently only three controls in all of the categories combined, probably due to the "technology preview" status of the product:
XMLEditGrid--A data grid that binds against an XML control and allows for add, change, and delete functionality in XML files with virtually no code
- Hyperlink list--A hyperlink list control
- AssociatedLabel--A label that can be associated with a control for accessibility
There are other controls, but many of them are commercial components that require separate licensing. Custom controls are one of the things that made VB so wildly popular, and Microsoft is wise to include that functionality in both Web Matrix and ASP.NET.
Figure 4: You can download Web controls from the Online Component Gallery.
It is also very easy to create and consume XML Web Services using this tool, making it a powerful way to get started with this new application development paradigm. In fact, you can create an XML Web Service in about 30 seconds. To do so, you add a new file and select the XML Web Service template, then drop code similar to this into the code window:
Return "Hello, " & sName
End Function
Click the Run button to invoke a tester that allows you to set parameters for and retrieve the results from your new XML Web Service. Way too easy!
Database Connectivity
The Web Matrix IDE works natively with MSDE and SQL Server databases. When I initially tried to install MSDE by just downloading it and running SETUP, it complained about a strong password being required for SA. SA is the equivalent of QSYSOPR in SQL Server and MSDE. Unfortunately, it didn't ask me to provide one, it just complained about not having one. The version of MSDE I downloaded was Service Pack 3 (SP3), which was created in response to the SQL Slammer worm that hit so many SQL Server machines recently. After researching the problem in the accompanying README files and the ASP.NET forums, I discovered that you can set an SA password by going to a command prompt, going to the directory where the SETUP program is, and entering the following:
Substitute your own strong password for sa_password. This sets the security to be handled by the database engine (rather than by Windows) and sets the SA password. Doing this got me past that installation hurdle, but I soon encountered another one: The installation proceeded almost to the end and then failed and rolled back on its own. I researched this problem, and not everyone has it (although a number do). Several possible solutions are offered in various forums and newsgroups, one of which finally worked for me. What I had to do was get rid of all traces of a botched installation, manually removing registry entries and files that weren't removed automatically. Once I had done that, I tried to create a new database. Unfortunately, another problem popped up: It said that there was no database server installed. After having read so much about it on various forums, I knew what the problem was. The SQLSERVERAGENT service was not started, so I right-clicked on My Computer, selected Manage, hit Services and Applications, then Services, then found SQLSERVERAGENT and started the service. After that, when I went back to create a database, it worked. Fortunately, it's not necessary to install MSDE to test Web Matrix, and hopefully, the MSDE installation problems I encountered will go away as the platforms and tools mature.
So how are the database connectivity options with ASP.NET Web Matrix? Actually, they're pretty robust. You can create tables and other database objects from within the environment, add and edit data in tables, and drag and drop tables from the database window to the Web page design view to automatically add a grid and bound data control to the page. You can set properties for items visually (Figure 5) , just as you can in Visual Basic. At runtime, standard HTML is generated, and any browser can display the page and use it to manipulate the database.
Datalists, another powerful Web Matrix tool, let you customize the appearance of bound lists in many different ways. They give you a means of visually designing sections of the data list that are displayed at different times. For example, the header and footer sections are displayed before and after the data list, and the data item section is displayed for each item (record) in the data list. It's surprisingly easy to create a bound dropdown listbox that populates with master records (orders, for example) when the page loads and that populates the related detail records (order line items, for example) automatically when a particular master record is selected. A pretty sophisticated application is generated behind the scenes, and you have to write just a small amount of code to tie everything together. Much of the tedium of creating code that connects to your database and binds your recordsets to the controls is generated for you by using wizards and visually setting properties.
Figure 5: Properties can be set visually, just as you can with Visual Basic.
Deploying ASP.NET Web Matrix Applications
Although Web Matrix comes with its own Web server, that server only works for local requests--those from your development machine. To serve pages and applications created by Web Matrix to the public, you'll need to use Microsoft's IIS. The Web server will also need to support ASP.NET pages, which is a free download. You can also get your pages hosted at ISPs that support ASP.NET. Web Matrix includes a built-in FTP client, so once your server environment meets the requirements, you simply FTP the application files to the server to deploy them.
Jump into the .NET
As you can see, ASP.NET Web Matrix provides a powerful tool to get your feet wet in the .NET development. If you're in a Microsoft environment and at all interested in easy Web development or XML Web service creation and consumption, you may want to download it, install it, and put it through the paces yourself.
When he's not riding across the desert or blogging, Brian Singleton is busy helping organizations make the best use of their ever-more-complex IT investments. He can be reached at
LATEST COMMENTS
MC Press Online