Направо към съдържанието

Active Server Pages

от Уикипедия, свободната енциклопедия

Шаблон:Infobox software Active Server Pages (ASP), още познат като Classic ASP или ASP Classic, е първата разработка наMicrosoft свързана със сървъри, двигателен скрипт за динамично-генерирани уеб страници. Първоначално пуснат като добавка за Internet Information Services (IIS) чрез Windows NT 4.0 Option Pack, впоследствие бе включен като свободен компонент на Windows Server (в първоначалната версия на Windows 2000 Server). В момента е бил заменен от ASP.NET.

Развитието на функционалността на ASP сайтовете е активирана от активен скрипт в двигателна поддръжка на Component Object Model (COM), с всеки обект 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 led to the terms Classic ASP or ASP Classic 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.

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.Шаблон:When

Prior to Microsoft's release of ASP for IIS 3, web programmers working in IIS relied on IDC and HTX files combined with ODBC drivers to display and manipulate dynamic data and pages. 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 on almost any operating system. iASP appears to 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, initially released in 1997, was acquired by Cobalt Networks on May 24, 2000. Cobalt Networks subsequently was purchased by Sun Microsystems on December 7, 2000. Chili!Soft was 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]

Versions

ASP has gone through three major releases:

  • ASP version 1.0 (distributed with IIS 3.0) in December 1996
  • ASP version 2.0 (distributed with IIS 4.0) in September 1997
  • ASP version 3.0 (distributed with IIS 5.0) in November 2000

ASP 3.0 is currently available in IIS 6.0 on Windows Server 2003 and IIS 7.0 on Windows Server 2008.

ASP.NET is often confused as the newest release of ASP, but the technologies are very different. ASP.NET relies on the .NET Framework and is a compiled language, whereas ASP is strictly an interpreted scripting language.

The move from ASP 2.0 to ASP 3.0 was a relatively modest one. One of the most important additions was the Server.Execute methods, as well as the ASPError object.[3] Microsoft's What's New in IIS 5.0 lists some additional changes.

There are solutions to run "Classic ASP" sites as standalone applications, such as ASPexplore, a software package that runs Microsoft Active Server Pages offline.

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:

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

Or in a simpler format

<html>
<body>
<%= "Hello World!" %>
</body>
</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

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

See also

References

Уикикниги
Уикикниги
В Уикикниги има на разположение: