Active Server Pages

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

Lua error in package.lua at line 80: module 'strict' not found.

Active Server pages
Developer(s) Microsoft
Stable release 3.0 / February 17, 2000; 24 years ago (2000-02-17)
Development status Discontinued
Type Web application framework
License Commercial proprietary software
Website {{#property:P856}}
Active Server Pages
Filename extension .asp
Developed by Microsoft

Active Server Pages (ASP), later known as Classic ASP or ASP Classic, is Microsoft's first server-side script engine for dynamically generated web pages. ASP.NET, first released in January 2002, has superseded ASP.

History

Initially released as an add-on to Internet Information Services (IIS) via the Windows NT 4.0 Option Pack (ca. 1996), it is included as a free component of Windows Server (since the initial release of Windows 2000 Server). There have been three versions of ASP, each introduced with different versions of IIS:[1]

  • ASP 1.0 was released on December 1996 as part of IIS 3.0
  • ASP 2.0 was released on September 1997 as part of IIS 4.0
  • ASP 3.0 was released on November 2000 as part of IIS 5.0

ASP 2.0 provides six built-in objects: Application, ASPError, Request, Response, Server, and Session. Session object, for example, represents a session that maintains the state of variables from page to page.[2] The Active Scripting engine's support of the Component Object Model (COM) enables ASP websites to access functionality in compiled libraries such as DLLs.

ASP 3.0 does not differ greatly from ASP 2.0 but it does offer some additional enhancements such as Server.Transfer method, Server.Execute method, and an enhanced ASPError object. ASP 3.0 also enables buffering by default and optimized the engine for better performance.

ASP remains supported until 14 January 2020 on Windows 7.[3] The use of ASP pages will be supported on Windows 8 for a minimum of 10 years from the Windows 8 release date.[3]

Architecture

ASP use server-side scripting to generate contents that would be sent to the visitor's web browser. The ASP interpreter reads and executes all script code between <% and %> tags, the result of which is content generation. These scripts are written using VBScript, JScript and PerlScript. The @Language directive, the <script language="manu" runat="server" /> syntax or server configuration can be used to select the language. In the example below, Response.Write Now() is in an HTML page; it would be dynamically replaced by the current time of the server.

Server side What client receives
The server's current time:<br />
<%
Response.Write Now()
%>
The server's current time:<br />
8/11/2015 6:24:45 PM

Web pages with the .asp filename extension use ASP, although some web sites disguise their choice of scripting language for security purposes by using the more common .htm or .html extensions. Pages with the .aspx extension use compiled ASP.NET; however, ASP.NET pages may still include some ASP scripting. The introduction of ASP.NET led to use of the term Classic ASP for the original technology.

ASP runs only on Windows. A number of products emulate some of the functionality of Classic ASP on non-Microsoft web servers. Apache::ASP for example ports Classic ASP to the Apache Web Server, but can only interpret PerlScript.[4]

Sun Java System ASP (formerly ChiliSoft ASP) was a popular and reportedly complete emulator,[5] but it has been discontinued.


The Request object

Allows data to be read that was sent by the client browser: Form, Querystring, and HTTP Cookie. It also provides information on the server, the client browser, and retrieve HTTP Cookie stored on the visitor's machine. Can retrieve data from a form using both methods HTTP:

Request.Form reads data sent by POST.

Request.QueryString reads data sent by GET.

<%
Response.Write("Welcome " & Server.HTMLEncode(Request.QueryString("name")) & "!")
%>

The Response object

Can send information to the client, such as the writing of the text on a page or HTTP Cookie.

<%
If (Len(Request.QueryString("name")) > 0) Then
     Response.Cookies("name") = Request.QueryString("name") 
End If

Response.Write "Welcome " & Server.HTMLEncode(Response.Cookies("name")) & "!"
%>

The Server object

Allows connections to databases (ADO), filesystem, and use of components installed on the server.

<%
Dim oAdoCon, oAdoRec, oAdoStm, oCdoCon, oCdoMsg, oSciDic, oSciFsm, oMswAdr

Set oAdoCon = Server.CreateObject("ADODB.Connection")
Set oAdoRec = Server.CreateObject("ADODB.Recordset")
Set oAdoStm = Server.CreateObject("ADODB.Stream")
Set oCdoCon = Server.CreateObject("CDO.Configuration")
Set oCdoMsg = Server.CreateObject("CDO.Message")
Set oSciDic = Server.CreateObject("Scripting.Dictionary")
Set oSciFsm = Server.CreateObject("Scripting.FileSystemObject")
Set oMswAdr = Server.CreateObject("MSWC.AdRotator")
%>

The Application object

Stores global variables.

<%
Application("Ali") = "My ASP Application"
Response.Write("Welcome to " & Server.HTMLEncode(Application("Ali")) & "!")
%>

The Session object

Stores variables accessible only to a single visitor.

<%
If (Len(Request.QueryString("name")) > 0) Then
     Session("name") = Request.QueryString("name") 
End If

Response.Write("Welcome " & Server.HTMLEncode(Session("name")) & "!")
%>

The Error object

Allows for the management of errors.

<%
On Error Resume Next

Dim o_Error
Set o_Error = Server.GetLastError()

Response.Write("Asp Code: " & Server.HTMLEncode(o_Error.AspCode) & "<BR />")
Response.Write("Asp Description: " & Server.HTMLEncode(o_Error.AspDescription) & "<BR />")
Response.Write("Category: " & Server.HTMLEncode(o_Error.Category) & "<BR />")
Response.Write("Column: " & Server.HTMLEncode(o_Error.Column) & "<BR />")
Response.Write("Description: " & Server.HTMLEncode(o_Error.Description) & "<BR />")
Response.Write("File: " & Server.HTMLEncode(o_Error.File) & "<BR />")
Response.Write("Line: " & Server.HTMLEncode(o_Error.Line) & "<BR />")
Response.Write("Number: " & Server.HTMLEncode(o_Error.Number) & "<BR />")
Response.Write("Source: " & Server.HTMLEncode(o_Error.Source) & "")

If (Err.Number <> 0) Then 
     Err.Clear 
End If 
%>

See also

References

  1. http://www.visualsolutions-co.com/services/what-is-asp.php
  2. The session data is kept server-side, the ID is saved as a HTTP Cookie. Source: ASP and Web Session Management, Microsoft
  3. 3.0 3.1 Lua error in package.lua at line 80: module 'strict' not found.
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.

External links