Active Server Pages

From Wikipedia, the free encyclopedia

Jump to: navigation, search
Active Server Pages
Developed by Microsoft
Latest release 3.0
Type Web application framework
License Proprietary

Active Server Pages (ASP), also known as Classic ASP, was Microsoft's first server-side script engine for dynamically-generated web pages. Initially released as an add-on to Internet Information Services (IIS) via the Windows NT 4.0 Option Pack, it was subsequently included as a free component of Windows Server (since the initial release of Windows 2000 Server).

Developing functionality in ASP websites is enabled by the active scripting engine's support of the Component Object Model (COM), with each object providing a related group of frequently-used functions and data attributes. In ASP 2.0 there were six built-in objects: Application, ASPError, Request, Response, Server, and Session. Session, for example, is a cookie-based session object that maintains the state of variables from page to page. Functionality is further extended by objects which, when instantiated, provide access to the environment of the web server; as an example FileSystemObject (FSO) is used to create, read, update and delete files.

Web pages with the .asp file extension use ASP, although some Web sites disguise their choice of scripting language for security purposes (e.g. still using the more common .htm or .html extension). Pages with the .aspx extension are ASP.NET (based on Microsoft's .NET Framework) and compiled, which makes them faster and more robust than server-side scripting in ASP which is interpreted at run-time; however, many ASP.NET pages still include some ASP scripting. Such marked differences between ASP and ASP.NET have lead to the term Classic ASP being used, which also implies some nostalgia for the simpler platform.

Most ASP pages are written in VBScript, but any other Active Scripting engine can be selected instead by using the @Language directive or the <script language="language" runat="server"> syntax. JScript (Microsoft's implementation of ECMAScript) is the other language that is usually available. PerlScript (a derivative of Perl) and others are available as third-party installable Active Scripting engines.

Contents

[edit] History

Based on the dbWeb and iBasic tools, created by Aspect Software Engineering, ASP was one of the first web application development environments that integrated web application execution directly into the web server, 9 months after the release of NeXT's (now Apple) WebObjects. This was done in order to achieve high performance compared to calling external executable programs or CGI scripts which were the most popular method for writing web applications at the time. Today there are additional platforms for web application development that are more common on other operating systems. Both JavaServer Pages and PHP are more commonly found on webservers running non-Microsoft operating systems, with PHP currently being the more common of the two. Also of note is ColdFusion, a popular Adobe Systems platform running on several operating systems (including Microsoft servers).

Prior to Microsoft's release of ASP for IIS 3, programmers relied on IDC and HTX files combined with ODBC drivers to display and manipulate dynamic data and pages running on IIS. The basics of these file formats and structures were used, at least in part, in the implementation of the early versions of ASP.

Halcyon InstantASP (iASP) and Chili!Soft ASP are third-party products that run ASP on platforms other than the Microsoft Windows operating systems. Neither alternative to real ASP fully emulates every feature, and may require additional components with which traditional ASP has no issues, such as database connectivity. MS access database support is a particular issue on non-Windows systems.

iASP is able to use the VBScript and JScript languages unlike Chili!Soft ASP which uses JScript. Microsoft's ASP can use both and has the potential to have other languages make use of the scripting engine. iASP was written in Java, and as such will run any almost any operating system. iASP appears be no longer available or at least hard to find.

Examples of other languages available are Perl and TCL, although they are not as widely known or used for ASP scripting. There is an Apache Webserver mod that runs an ASP-like Perl script language.[1]

Chili!Soft was purchased by Sun Microsystems and later renamed "Sun ONE Active Server Pages", then later renamed to "Sun Java System Active Server Pages". Chilisoft ASP was written in C/C++ and is tied rather tightly to specific web server versions. According to Sun "Sun Java System Active Server Pages has entered its End Of Life".[2]

[edit] Sample usage

Any scripting languages compatible with Microsoft's Active Scripting standard may be used in ASP. The default scripting language (in classic ASP) is VBScript:

  1. <html>
  2. <body>
  1. <% Response.Write "Hello World!" %>
  1. </body>
  2. </html>

Or in a simpler format

  1. <html>
  2. <body>
  1. <%= "Hello World!" %>
  1. </body>
  2. </html>

The examples above print "Hello World!" into the body of an HTML document.

Here's an example of how to connect to an Access Database

  1. <%
  2.         Set oConn = Server.CreateObject("ADODB.Connection")
  3.         oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("DB.mdb")
  4.         Set rsUsers = Server.CreateObject("ADODB.Recordset")
  5.         rsUsers.Open "SELECT * FROM Users", oConn
  6. %>


[edit] See also

PHP

[edit] References

  1. ^ "Apache::ASP". Chamas Enterprises Inc. http://www.apache-asp.org/. Retrieved on 2009-01-08. 
  2. ^ "Sun Java System Active Server Pages". Sun Microsystems. http://www.sun.com/software/chilisoft/. Retrieved on 2008-12-31. 

[edit] External links

Personal tools