An Application, its Files, and its Objects |
|
An Active Server Pages consists of web files grouped into a web site with some files used to perform the necessary processing. To support the various possible scenarios of this type of application, there are two main categories of files you will use: regular pages and ASP-based files. An HTML-based application is a web-based project that mostly includes regular pages with HTML tags, optional Cascading Style Sheet formatting, and optional scripts to perform some tasks that are difficult or impossible with only HTML. You can also use other formatting languages like XML to support some type of data in your application but an HTML-based application is primarily meant to use HTML tags to present text and graphics to a visitor. With this type of application, you usually don't expect any back-and-forth interaction between the visitor and you. To create an HTML-based application, there is no special thing to do in Microsoft Visual Studio because the structure of this type of application lies on its use of web-oriented files. There are only two primary requirements. To start, you must create a folder with a name of your choice. You can create this folder using a utility such as Windows Explorer or My Computer. After creating the folder of your web-based application, you can create the necessary files for it. The most regularly used files are text-based but they have the .htm or .html extension. This type of file is called an HTML file. You can create the file using Notepad. Alternatively, you can use a commercial application such as Microsoft FrontPage or Microsoft Visual Studio .NET to create an HTML file
HTML has limitations that make it impossible to support an active level of interaction between a visitor and you. This is why Microsoft developed Active Server Pages, which was a technique of using Microsoft Internet Information Server (4.0) and scripting languages such as VBScript or JavaScript to create interactive pages, more structured that traditional HTML files. An Active Server Pages application is a web site that includes HTML and optional files that have an .asp extension. In fact, the essence of an ASP-based application is to have at least one file with that extension. You can create an Active Server Pages application without using any formal programming environment. To start, you should create a folder that would hold the files of your application. You can use Windows Explorer or My Computer to do this. If you want, the next non-required step would consist of creating a simple text-based file named Global and that has the .asax extension (Global.asax). This file would be used later on to process files at the application level. In Microsoft Visual Studio 6.0, to support Active Server Pages, Microsoft created Visual Interdev. After creating the necessary folder for your project, you can create the necessary files. You can use Notepad to create the file(s) as long as you remember to add the .asp extension when you decide to save it(them). |
Web Controls |
A web control is an object added to a web page and that allows the user to request or submit values to your server. These lessons assume that you are familiar with how to create these controls from your background in VBScript. At the risk of repeating everything, we'd rather not review them here. Still, in the next lesson, we will review forms. |
Cascading Style Sheet |
Cascading Style Sheet (CSS) is a technique of assisting HTML with some formatting applied to a control on a web page. If you have studied Cascading Style Sheet, everything you know about this formatting language can be applied to Active Server Pages. As you may know, there are three main ways CSS is used in a web page. To apply it to an HTML tag, you create a style attribute in the HTML tag and assign the necessary values to it. For a <p> tag, it can start as follows: <p style=""></p> This can be referred to as local style because it affects only the tag in which the style is created. If you use this technique, each (HTML or Active Server Pages) tag must have its own style. What goes inside of the double-quotes of the style attribute depends on what formatting you want to apply. You must respect the rules of Cascading Style Sheet when adding a style. The second technique used to apply Cascading Style Sheet to your web page consists of creating the necessary styles in the <head> tag of the file. Here is an example from an ASP file: |
<%@ Language="VBScript" %> <html> <head> <title>Active Server Pages Tutorials</title> <style> body { font-family: Verdana, Helvetica, Arial, sans-serif; color: #000000; font-size: 10pt; background-color: #FF9900 } </style> </head> <body> <h1>Lesson 3: Active Pages</h1> <% Response.Write("<b>Lecturer:</b> Benjamin Jacobson") %> <br> <% Response.Write("<b>Time Allocated:</b> <i>52 minutes</i>") %> <p>This lesson shows different ways of displaying items on a web page. The instructions involve both HTML and scripts</p> <h3>Enjoy</h3> </body> </html>
This can be referred to as file-level style because the style created in the head section affects, or can be applied to, any tag of the page. If you use this technique, each HTML tag that is tied to the HTML tag defined, such as <body> in this case would be affected. As you probably know already, Cascading Style Sheet also supports a type of pseudo-object-oriented-programming where you create classes and define their characteristics using existing CSS keywords. Here is an example: |
<%@ Language="VBScript" %> <html> <head> <title>Active Server Pages Tutorials</title> <style> body { font-family: Verdana, Helvetica, Arial, sans-serif; color: #000000; font-size: 10pt; background-color: #FF9900 } .maintitle { font-family: Georgia, Garamond, 'Times New Roman'; font-size: 24pt; color: #FF0000; text-align: center; font-weight: bold } </style> </head> <body> <p class="maintitle">Lesson 3: Active Pages</p> <% Response.Write("<b>Lecturer:</b> Benjamin Jacobson") %> <br> <% Response.Write("<b>Time Allocated:</b> <i>52 minutes</i>") %> <p>This lesson shows different ways of displaying items on a web page. The instructions involve both HTML and scripts</p> <h3>Enjoy</h3> </body> </html>
The third technique used to integrate CSS in your web page consists of creating a separate CSS file and referencing it in your (HTML or Active Server Pages) web page. After creating and saving the file with .css extension, you can reference it by its name. For example if you create a file named Example.css, to use its formats in your web page, in the head section of the page, you would type: <link rel="stylesheet" type="text/css" href="Example.css"> The advantage of this application-level style is that the same style can be applied to different pages of your web site, as long as you remember to reference the CSS file. Active Server Pages supports all three techniques of using CSS in your web pages. You can create your CSS formatting using Notepad or any text editor. You can also use any commercial application of your choice, such as Microsoft FrontPage or Microsoft Visual Studio .NET, to create the CSS code. |
|
||
Previous | Copyright © 2005-2016, FunctionX | Next |
|