Introduction to ASP.NET


ASP.NET Prerequisites



Active Server Pages (ASP) is a technology to create dynamic web sites that allow a visitor to submit values to a web page. The web page would then transmit the results to a web server. This technology requires some use and knowledge of a scripting language such as VBScript or JavaScript. It is also easily understandable to Visual Basic programmers because both use the same approach to solve problems. To enhance it, Microsoft developed ASP.NET. This new approach allows you to use the .NET Framework and its rich features to create web-based applications.

The .NET Framework is a library used to create both computer-based and web-based applications. It is made of different parts. The section that deals with computer applications is referred to as Windows Forms. The part dedicated to the web is called ASP.NET. Although these various sub-libraries make up the .NET Framework, you can create fully functional applications using only ASP.NET. One of the differences between ASP.NET and ASP is that ASP applications were mostly interpreted (except for some libraries (DLLs) that were working in the background at the server level during processing) by the browser while ASP.NET applications are compiled.

ASP.NET Prerequisites

To create ASP.NET applications, you must prepare your computer, the one you will be using to develop your applications. To start, your computer should run one of the following operating systems:

  • Microsoft Windows XP Professional (no Home Edition)
  • Microsoft Windows Vista
  • Microsoft Windows 2000 Server
  • Microsoft Windows Server 2003 (any version)

Also, you should (according to Microsoft, "must"; but you will see in our lessons that we will be using different browsers to test the pages) install the latest Internet Explorer browser. The minimum you should have is Internet Explorer 5.5 but, unless you have any particular reason, you should install the 6.0 version.

To support databases (even if you don't intend to create web-based databases), you must install MDAC 2.7 or later, which is a free download from the Microsoft web site. Normally, you may have MDAC installed already but just in case you need it...

Along with one of the above operating systems, you must install Microsoft Internet Information Services (IIS) 6.0 or later. Normally, during the installation of the operating system, you would have been prompted to install it. Otherwise, you can install it from Control Panel -> Add/Remove Programs -> Add/Remove Windows Components -> Internet Information Services (IIS) and follow the steps:

If you are using Microsoft Windows Vista Home Premium, IIS is not installed by default. To install it:

  1. Open the Control Panel
  2. Click Programs and click Programs and Features (normal view), or double-click Programs and Features (Classic View)
  3. Click Turn Windows features on or off. If you receive a warning, click Continue
  4. In the Windows Features dialog box, expand Internet Information Services
  5. Click the check box of each option you want to install. Here is an example:
    Windows Features
  6. Click OK.
    The installation and setup of the features you selected would start

If necessary, you must install the .NET Framework. It is likely to be installed already. You should install he latest. If you want to check, you can open the Add/Remove Programs from Control Panel and you should see an entry for Microsoft .NET Framework:

Add or Remove Programs

You can also see its entry in the Start menu. If you don't have it already, you can download it (free) from the Microsoft web site at http://www.asp.net.

To follow the lessons on this site, you must be a little familiar with HTML. It is not realistic to teach HTML and web application development at the same time.

In our lessons, we will mostly assume that you don't know the Visual Basic language.

Preparing Web Tests

Starting in the next lesson, we will learn how to create web pages. After creating a web page, you should test it. You have two options. You can test a page locally by executing your project as we will learn in the next lesson. Alternative, you can test it on a real web site. You have various alternative. You can setup a web server at home or at your job to host your (own) web site. The process is, or can be, long and there are various issues involved (name registration, DNS, etc).

An alternative to hosting your web site is to let another company host it for you. We wrote a few topics on this issue. When selecting a company that would host your web site, make sure that (specify to your hosting company that) your site can display ASP.NET web pages. Also make sure they have tested it and it works fine.

Preparing an ASP.NET Application


ASP.NET and Regular Web Files

A web site is a series of files as web pages grouped in a main parent folder. An ASP.NET project is one or more files presented as an application.

Like any regular web site, an ASP.NET application can include different types of files, that is, files with different extensions intended to serve different purposes. This means that, to create an ASP.NET application, you can start by creating HTML files which are files with .htm or .html extension. You can also use Cascading Style Sheet (CSS) files that would allow you to better format or interpret HTML tags. You can also use script-oriented files that have the .js, .vbs. .pl, etc extensions to complement the other pages.

The Virtual Folder 

As you would proceed for a normal web site, to start an ASP.NET application, you can create a folder with a name of your choice. Here is an example of a new folder named Grier Summer Camp:

A New Folder

After creating a folder for your project, you should create a virtual directory. To do this, you can first display the Internet Information Services or the Internet Services Manager window (if you are using Microsoft Windows XP Professional, from Control Panel, double-click Administrative Tools then double-click Internet Information Services). Then, in the left frame (of the MMC), expand the name of your server (if you are planning to use another server or computer but is not listed, right-click Internet Information Services, click Connect, type the name of the computer and click OK) and optionally expand the Default Web Site node (if you are using MS Windows XP Professional, you must expand the Web Site node under the computer). Right-click Default Web Site -> New -> Virtual Directory. In the first page of the wizard, you would click Next. In the second page, you must type the name you will use on the browser to access the application you are creating. Here is an example:

Virtual Directory

In the third page, you can type the full path to the folder you created or you can click Browse to locate and select the folder you had previously created. In the Browse For Folder dialog box, locate the folder you created:

Virtual Directory

The fourth page allows you to specify how the pages on this site will be accessed:

 Virtual Directory

After clicking Next in the fourth page, you can click Finish in the fifth page: A new web site would have been created for your application.



After creating the web site, you can add the necessary files to it. You can create text files and save them with the appropriate extension. When saving the files, make sure you store them in the folder you would have created. This would make it possible for the browser to locate them through the virtual directory.

ASP.NET own pages are text-based files with the .aspx extension. The content of the file is up to you and it doesn't have to have special code than regular HTML tags. Here is an example of a normal HTML-tagged file:

<title>Grier Summer Camp</title>

<center><h1>The Grier Summer Camp</h1></center>

<p>Located in the heart of Rockville, Maryland, the <b>Grier Summer Camp</b> 
is an attractive setting aimed at entertaining and supporting youth activities 
during their summer vacation.</p>

<h2>Program Presentation</h2>

<p>We feature a state of the art, regularly renovated mansions with world 
class sport facilities.</p>

<p>Coolfront Island, our star house of the season, is a 2-story like chateau 
featuring nicely finished brown bricks whose sight is tremendously appealing. 
The estate introduces two large living rooms with exquisite velour furniture. 
The colonial veranda offers a patio spanning two walls with a lost view down 
the far-reaching landscape. In this particular setting, besides their usual 
activities, children will learn special human needs to make their experience 

<p>Please consult our catalogue and see why the Washington Tribune called 
us <i>the most attractive summer camp of the area</i>.</p>


After creating the file, you should save it with the .aspx extension in a folder of your choice:

Save As

After saving the file, to preview it, in the Internet Information Services window, first locate the virtual directory of the project. Then, you can right-click the file (if you don't see the file, right-click the virtual directory and click Refresh) and click Browse. Alternatively, you can open  the browser and access its Address bar, change the address to http://localhost/ followed by the name of the virtual directory, and followed by the name of the file with its extension:


Your browser may show only the source code:

  Browser Shows Source Code

If this happens, in the Address bar, change localhost to the name of your computer. For example, mine is named Central:

Web Page Preview


Home Copyright © 2009-2015, FunctionX, Inc. Next