17
Sun, Nov
2 New Articles

Microsoft Computing: Got .NET Yet? Get a Taste with ASP.NET Web Matrix

Microsoft
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
When Microsoft first announced its .NET initiative, the whole thing amounted to little more than technology previews, strategic directions, and white papers. Since then, Microsoft has not-so-quietly been integrating .NET into virtually all of its upcoming product offerings, touting it as the platform for the future. If you have been sitting on the .NET sidelines, it may be time for you to start looking at what .NET can offer you and your shop. Prior to the release of a new tool that is the subject of this article, the road to .NET was somewhat long and arduous. Fortunately, with the recent release of ASP.NET Web Matrix, the road has become a lot easier.

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.

http://www.mcpressonline.com/articles/images/2002/Got%20Dot%20Net%20YetV400.png

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.


http://www.mcpressonline.com/articles/images/2002/Got%20Dot%20Net%20YetV401.png

Figure 2: The General templates include a number of common file types.

http://www.mcpressonline.com/articles/images/2002/Got%20Dot%20Net%20YetV402.png

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.


http://www.mcpressonline.com/articles/images/2002/Got%20Dot%20Net%20YetV403.png

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:

 Public Function SayHello(sName As string) As string
    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:

SETUP SECURITYMODE=SQL SAPWD=sa_password


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.

http://www.mcpressonline.com/articles/images/2002/Got%20Dot%20Net%20YetV404.png

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 This email address is being protected from spambots. You need JavaScript enabled to view it..

Brian Singleton
Brian Singleton is former editor of Midrange Computing. He has worked in the IBM midrange arena for many years, performing every job from backup operator to programmer to systems analyst to technology analyst for major corporations and IBM Business Partners. He also has an extensive background in the PC world. Brian also developed a line of bestselling Midrange Computing training videos, authored the bestselling i5/OS and Microsoft Office Integration Handbook, and has spoken at many popular seminars and conferences.

MC Press books written by Brian Singleton available now on the MC Press Bookstore.

i5/OS and Microsoft Office Integration Handbook i5/OS and Microsoft Office Integration Handbook
Harness the power of Microsoft Office while exploiting the iSeries database.
List Price $79.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: