ASP.NET


Introduction to ASP.NET

Introduction
Active Server Pages (ASP) is a technology developed primarily by Microsoft 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:
Click the check box of each option you want to install. Here is an example:

Windows Features
  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 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.
Preparing Web Tests
 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 alternatives. 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. 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.