Article

Build Your Own ASP.NET Website Using C# And VB.NET, Chapter 1 - Introduction to .NET and ASP.NET

Page: 1 2 3 4 5 6 Next

Build Your Own ASP.NET Website Using C# & VB.NET, Chapter 1 - Introduction to .NET and ASP.NET

It's being touted as the "next big thing." Microsoft has invested millions in marketing, advertising, and development to produce what it feels is the foundation of the future Internet. It's a corporate initiative, the strategy of which was deemed so important, that Bill Gates himself, Microsoft Chairman and CEO, decided to oversee personally its development. It is a technology that Microsoft claims will reinvent the way companies carry out business globally for years to come. In his opening speech at the Professional Developers' Conference (PDC) held in Orlando Florida in July of 2000, Gates stated that a transition of this magnitude only comes around once every five to six years. What is this show-stopping technology? It's .NET.

What is .NET?

.NET is the result of a complete make-over of Microsoft's software development products, and forms part of the company's new strategy for delivering software as a service. The key features that .NET offers include:

  • .NET Platform: The .NET platform includes the .NET Framework and tools to build and operate services, clients, and so on. ASP.NET, the focus of this book, is a part of the .NET Framework.
  • .NET Products: .NET products currently include MSN.NET, Office.NET, Visual Studio.NET, and Windows Server 2003, originally known as Windows .NET Server. This suite of extensively revised systems provides developers with a friendly, usable environment in which they may create applications with a range of programming languages including C++. NET, Visual Basic.NET, ASP.NET, and C#. Because all these products are built on top of .NET, they all share key components, and underneath their basic syntaxes you'll find they have much in common.
  • .NET My Services: An initiative formerly known as "Hailstorm", .NET My Services is a set of XML Web Services (Don't worry if you don't yet know what a Web Service is. I'll explain all about them in Chapter 17, XML Web Services.) currently being provided by a host of partners, developers, and organizations that are hoping to build corporate services and applications for devices and applications, as well as the Internet. The collection of My Services currently extends to passport, messenger, contacts, email, calendars, profiles, lists, wallets, location, document stores, application settings, favorite Websites, devices owned, and preferences for receiving alerts.

The book focuses on one of the core components within the .NET Framework: ASP.NET.

What is ASP.NET?

For years now, Active Server Pages (ASP) has been arguably the leading choice for Web developers building dynamic Websites on Windows Web servers. ASP has gained popularity by offering the simplicity of flexible scripting via several languages. That, combined with the fact that it's built into every Microsoft Windows-based Web server, has made ASP a difficult act to follow.

Early in 2002, Microsoft released its new technology for Internet development. Originally called ASP+, it was finally released as ASP.NET, and represents a leap forward from ASP both in sophistication and productivity for the developer. It continues to offer flexibility in terms of the languages it supports, but instead of a range of simple scripting languages, developers can now choose between several fully-fledged programming languages. Development in ASP.NET requires not only an understanding of HTML and Web design, but also a firm grasp of the concepts of object-oriented programming and development.

In the next few sections, I'll introduce you to the basics of ASP.NET. I'll walk you through installing it on your Web server, and take you through a simple dynamic example that demonstrates how ASP.NET pages are constructed. First, let's define what ASP.NET actually is.

ASP.NET is a server-side technology for developing Web applications based on the Microsoft .NET Framework. Let's break that jargon-filled sentence down.

ASP.NET is server-side; that is, it runs on the Web server. Most Web designers start by learning client-side technologies like HTML, JavaScript, and Cascading Style Sheets (CSS). When a Web browser requests a Web page created with client-side technologies, the Web server simply grabs the files that the browser (the client) requests and sends them down the line. The client is entirely responsible for reading the code in the files and interpreting it to display the page on the screen. Server-side technologies, like ASP.NET, are different. Instead of being interpreted by the client, server-side code (for example, the code in an ASP.NET page) is interpreted by the Web server. In the case of ASP.NET, the code in the page is read by the server and used dynamically to generate standard HTML/JavaScript/CSS that is then sent to the browser. As all processing of ASP.NET code occurs on the server, it's called a server-side technology. As Figure 1.1 shows, the user (client) only sees the HTML, JavaScript, and CSS within the browser. The server (and server-side technology) is entirely responsible for processing the dynamic portions of the page.

1323_fig1
Figure 1.1. The Web server is responsible for processing the server-side code and presenting the output to the user (client).

ASP.NET is a technology for developing Web applications. A Web application is just a fancy name for a dynamic Website. Web applications usually (but not always) store information in a database on the Web server, and allow visitors to the site to access and change that information. Many different programming technologies and supported languages have been developed to create Web applications; PHP, JSP (using Java), CGI (using Perl), and ColdFusion (using CFML) are just a few of the more popular ones. Rather than tying you to a specific technology and language, however, ASP.NET lets you write Web applications using a variety of familiar programming languages.

Finally, ASP.NET is based on the Microsoft .NET Framework. The .NET Framework collects all the technologies needed for building Windows applications, Web applications, and Web Services into a single package with a set of more than twenty programming languages. To develop Websites with ASP.NET, you'll need to download the .NET Framework Software Development Kit, which I'll guide you through in the next few sections.

Even with all the jargon demystified, you're probably still wondering: what makes ASP.NET so good? Compared with other options for building Web applications, ASP.NET has the following advantages:

  • ASP.NET lets you use your favorite programming language, or at least one that's really close to it. The .NET Framework currently supports over twenty languages, four of which may be used to build ASP.NET Websites.
  • ASP.NET pages are compiled, not interpreted. Instead of reading and interpreting your code every time a dynamic page is requested, ASP.NET compiles dynamic pages into efficient binary files that the server can execute very quickly. This represents a big jump in performance when compared with the technology's interpreted predecessor, ASP.
  • ASP.NET has full access to the functionality of the .NET Framework. Support for XML, Web Services, database interaction, email, regular expressions, and many other technologies are built right into .NET, which saves you from having to reinvent the wheel.
  • ASP.NET allows you to separate the server-side code in your pages from the HTML layout. When you're working with a team composed of programmers and design specialists, this separation is a great help, as it lets programmers modify the server-side code without stepping on the designers' carefully crafted HTML�and vice versa.

With all these advantages, ASP.NET has relatively few downsides. In fact, only two come to mind:

  • ASP.NET is a Microsoft technology. While this isn't a problem in itself, it does mean that, at least for now, you need to use a Windows server to run an ASP.NET Website. If your organization uses Linux or some other operating system for its Web servers, you're out of luck.
  • Serious ASP.NET development requires an understanding of object-oriented programming, which we'll cover over the next few chapters.

Still with me? Great! It's time to gather the tools and start building!

What Do I Need?

For the moment, if you're going to learn ASP.NET, you'll need a Windows-based Web server. Open source initiatives are underway to produce versions of ASP.NET that will run on other operating systems, such as Linux; however, these are not expected to be available in stable form for a while.

While developers had the option of getting their feet wet with ASP on Windows 95, 98, or ME, using a scaled-down version of IIS called a Personal Web Server (PWS), ASP.NET requires the real deal. As a bare minimum, you'll need a computer equipped with Windows 2000 Professional before you can get started. Windows XP Professional will work fine too, as will any of the Windows 2000 Server packages and Windows 2003 Server.

Other than that, all you need is enough disk space to install the Web server Internet Information Services (18 MB), the .NET Framework SDK (which includes ASP.NET; 108 MB), and a text editor. Notepad or Web Matrix will be fine for getting started, and are certainly all you'll need for this book. However, if you get serious about ASP.NET, you'll probably want to invest in a development environment like Visual Studio .NET.

Installing the Required Software

This section tackles the necessary installation and configuration of software that you'll need for this book, including:

  • Internet Information Services (IIS): IIS is the Web server we will use. You'll need your copy of the Windows CD for the installation and configuration.
  • A Modern Web Browser: You can use any modern, standards-compliant browser to test your work. Throughout this book, we'll be using Internet Explorer 6.
  • The .NET Framework Redistributable: As you've already learned in this chapter, the .NET Framework is what drives ASP.NET. Installing the .NET Framework installs the necessary files to run ASP.NET.
  • The .NET Framework SDK: The .NET Framework Software Development Kit (SDK) contains necessary Web application development tools, a debugger for error correcting, a development database engine in MSDE, and a suite of samples and documentation.

We're also going to need a database. In this book, we'll use:

  • Microsoft Access: Access is a cheap and easy-to-use alternative to its more robust big brother, SQL Server, and can be purchased separately, or installed from a Microsoft Office CD.

Or alternatively, you might use:

  • Microsoft SQL Server Desktop Engine (MSDE): SQL Server is the enterprise alternative to smaller databases such as Access. If you're working within a corporation where your company's data is its lifeblood, then SQL Server is the perfect choice. MSDE is a free, cut down version of SQL Server that you can use for development purposes.
  • Web Data Administrator: If you're going to use MSDE, then you'll need a tool for modifying the data within the database. Web Data Administrator is Microsoft's free Web-based database management tool.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links