Revision as of 09:30, 16 May 2009 editBeno1000 (talk | contribs)Pending changes reviewers3,659 editsNo edit summary← Previous edit | Latest revision as of 20:25, 19 September 2024 edit undoComputcon (talk | contribs)1 editNo edit summaryTag: Visual edit | ||
(457 intermediate revisions by more than 100 users not shown) | |||
Line 1: | Line 1: | ||
{{short description|Server-side java script engine}} | |||
{{ infobox software | |||
{{ multiple issues| | |||
| name = Active Server Pages | |||
{{primary sources|date=February 2015}} | |||
| logo = | |||
{{more citations needed|date=February 2015}} | |||
}} | |||
{{Infobox software | |||
| name = Active Server Pages (ASP) | |||
| logo = | |||
| developer = ] | | developer = ] | ||
| latest_release_version = 3.0 |
| latest_release_version = 3.0 | ||
| latest_release_date = |
| latest_release_date = {{Start date and age|2000|2|17}} | ||
| genre = ] | | genre = ] | ||
| license = ] | | license = ] | ||
| website = |
| website = | ||
}} | |||
{{Infobox file format | |||
| name = Active Server Pages | |||
| logo = | |||
| extension = .asp | |||
| mime = | |||
| type code = | |||
| uniform type = | |||
| magic = | |||
| owner = ] | |||
| genre = | |||
| container for = | |||
| contained by = | |||
| extended from = | |||
| extended to = | |||
| standard = | |||
| free = | |||
| url = | |||
}} | }} | ||
'''Active Server Pages''' ('''ASP''') |
'''Active Server Pages''' ('''ASP''') is ]'s first ] ] for ]s. | ||
It was first released in December 1996, before being superseded in January 2002 by ]. | |||
Developing functionality in ASP ]s is enabled by the ] engine's support of the ] (COM), with each ] providing a related group of frequently-used functions and data attributes. In ASP 2.0 there were six ] objects: Application, ASPError, Request, Response, Server, and Session. '''Session''', for example, is a ] ] object that maintains the state of ] from page to page. Functionality is further extended by objects which, when instantiated, provide access to the environment of the ]; as an example '''FileSystemObject''' (]) is used to ] ]. | |||
== History == | |||
Web pages with the ''.asp'' ] 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). | |||
Initially released as an add-on to ] (IIS) via the ] (1996), it is included as a component of ] (since the initial release of ]). There have been three versions of ASP, each introduced with different versions of IIS: | |||
Pages with the ''.aspx'' extension are ] (based on Microsoft's ]) and compiled, which makes them faster and more robust than ] 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. | |||
* ASP 1.0 was released in December 1996 as part of IIS 3.0 | |||
Most ASP pages are written in ], but any other ] engine can be selected instead by using the <tt>@Language</tt> directive or the <code><script language="language" runat="server"></code> syntax. ] (Microsoft's implementation of ]) is the other language that is usually available. ] (a derivative of ]) and others are available as third-party installable Active Scripting engines. | |||
* ASP 2.0 was released in September 1997 as part of IIS 4.0 | |||
* ASP 3.0 was released in November 2000 as part of IIS 5.0 | |||
ASP 2.0 provides six built-in ]: Application, ASPError, Request, Response, Server, and Session. A <code>Session</code> object, for example, represents a ] that maintains the state of ] from page to page.<ref>The session data is kept server-side, the ID is saved as a ]. Source: , Microsoft</ref> The ] engine's support of the ] enables ASP ]s to access functionality in compiled ] such as ]. | |||
==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) ]. This was done in order to achieve high performance compared to calling external executable programs or ] 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 ] and ] are more commonly found on webservers running non-Microsoft operating systems, with ] currently being the more common of the two. Also of note is ], a popular ] platform running on several operating systems (including Microsoft servers). | |||
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. | |||
Prior to Microsoft's release of ASP for IIS 3, programmers relied on ] and ] files combined with ] 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. | |||
ASP was supported until 14 January 2020 on ].<ref name=":0">{{cite web|title=Active Server Pages (ASP) support in Windows|url=https://support.microsoft.com/en-us/kb/2669020|website=Support|publisher=]|access-date=11 August 2015|date=30 January 2012|edition=4.0}}</ref> The use of ASP pages will be supported on ] for a minimum of 10 years from the Windows 8 release date.<ref name=":0" /> ASP is supported in all available versions of IIS as of 2024.<ref>Source: , Microsoft</ref> | |||
''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. | |||
== Architecture == | |||
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. | |||
ASP uses ] to generate content that is sent to the client's web browser via HTTP response. The ASP interpreter reads and executes all script code between <% and %> tags, the result of which is content generation. These scripts were written using ], ], or ]. The <code>@Language</code> directive, the {{tag|script|s|params=language="''language''" runat="server"}} syntax or server configuration can be used to select the language. In the example below, Response.Write Now() is in an ] page; it would be dynamically replaced by the current time of the server. | |||
{| | |||
! Server side !! Client Side | |||
|- style="vertical-align:top" | |||
|<syntaxhighlight lang="aspx-vb">The server's current time: | |||
<% | |||
Response.Write Now() | |||
%> | |||
</syntaxhighlight> | |||
|<syntaxhighlight lang="output">The server's current time: | |||
8/11/2015 6:24:45 PM</syntaxhighlight> | |||
|} | |||
Web pages with the ''.asp'' ] 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 ]; 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. | |||
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.<ref>{{web cite|url=http://www.apache-asp.org/|title=Apache::ASP|publisher=Chamas Enterprises Inc|accessdate=2009-01-08}}</ref> | |||
Sun Java System ASP (formerly ChiliSoft ASP) was a popular and reportedly complete emulator,<ref name="Weissinger2009">{{cite book|last=Weissinger|first=Keyton |title=ASP in a Nutshell: A Desktop Quick Reference|url=https://books.google.com/books?id=tUHeRwhGKcgC|access-date=9 October 2013|date=6 October 2009|publisher=O'Reilly Media, Inc.|isbn=978-1-4493-7959-9}}</ref> but it has been discontinued. | |||
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".<ref>{{web cite|url=http://www.sun.com/software/chilisoft/|title=Sun Java System Active Server Pages |publisher=Sun Microsystems|accessdate=2008-12-31}}</ref> | |||
===The Server object=== | |||
==Sample usage== | |||
The server object allows connections to databases (ADO), filesystem, and use of components installed on the server. | |||
Any scripting languages compatible with Microsoft's ] standard may be used in ASP. The default scripting language (in classic ASP) is ]: | |||
< |
<syntaxhighlight lang="vbscript"> | ||
<% | |||
<html> | |||
Dim oAdoCon, oAdoRec, oAdoStm, oCdoCon, oCdoMsg, oSciDic, oSciFsm, oMswAdr | |||
<body> | |||
</source> | |||
<source lang="asp" line start="3"> | |||
<% Response.Write "Hello World!" %> | |||
</source> | |||
<source lang="html4strict" line start="4"> | |||
</body> | |||
</html> | |||
</source> | |||
Set oAdoCon = Server.CreateObject("ADODB.Connection") | |||
Or in a simpler format | |||
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.Swingbridge") | |||
%> | |||
</syntaxhighlight> | |||
===The Application object=== | |||
<source lang="html4strict" line> | |||
This object stores global variables, which are variables accessible to all users. | |||
<html> | |||
<body> | |||
</source> | |||
<source lang="asp" line start="3"> | |||
<%= "Hello World!" %> | |||
</source> | |||
<source lang="html4strict" line start="4"> | |||
</body> | |||
</html> | |||
</source> | |||
<syntaxhighlight lang="aspx-vb"> | |||
The examples above print "Hello World!" into the body of an HTML document. | |||
<% | |||
Application("Ali") = "My ASP Application" | |||
Response.Write "Welcome to " & Server.HTMLEncode(Application("Ali")) & "!" | |||
%> | |||
</syntaxhighlight> | |||
===The Session object=== | |||
Here's an example of how to connect to an Access Database | |||
Stores variables accessible only to a single visitor, which are local variables. | |||
<source lang="ASP" line> | |||
<syntaxhighlight lang="vbscript"> | |||
<% | <% | ||
If Len(Request.QueryString("name")) > 0 Then | |||
Set oConn = Server.CreateObject("ADODB.Connection") | |||
Session("name") = Request.QueryString("name") | |||
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("DB.mdb") | |||
End If | |||
Set rsUsers = Server.CreateObject("ADODB.Recordset") | |||
rsUsers.Open "SELECT * FROM Users", oConn | |||
Response.Write "Welcome " & Server.HTMLEncode(Session("name")) & "!" | |||
%> | %> | ||
</syntaxhighlight> | |||
</source> | |||
The session object is file based and multiple concurrent read and/or write requests will be blocked and processed in turn. | |||
===The Err object=== | |||
Allows the management and fixing of non-fatal errors. | |||
<syntaxhighlight Lang="vbscript"> | |||
<% | |||
On Error Resume Next | |||
Response.Write 1 / 0 ' Division by zero | |||
If Err.Number <> 0 Then | |||
Response.Write "Error Code: " & Server.HTMLEncode(Err.Number) & "<br />" | |||
Response.Write "Error Source: " & Server.HTMLEncode(Err.Source) & "<br />" | |||
Response.Write "Error Description: " & Server.HTMLEncode(Err.Description) & "<br />" | |||
Err.Clear | |||
End If | |||
%> | |||
</syntaxhighlight> | |||
==See also== | ==See also== | ||
* ] | |||
* ] | * ] | ||
* ] | |||
* ] | |||
* ] | |||
* ] | |||
* ] | |||
==References== | == References == | ||
{{ |
{{Reflist}} | ||
==External links== | ==External links== | ||
Line 96: | Line 154: | ||
{{wikibooks|Active Server Pages}} | {{wikibooks|Active Server Pages}} | ||
* | * | ||
* | * | ||
* | |||
* | |||
* | |||
{{Web interfaces}} | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] |
Latest revision as of 20:25, 19 September 2024
Server-side java script engineThis article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
Developer(s) | Microsoft |
---|---|
Stable release | 3.0 / February 17, 2000; 24 years ago (2000-02-17) |
Type | Web application framework |
License | Proprietary software |
Website | www |
Filename extension | .asp |
---|---|
Developed by | Microsoft |
Active Server Pages (ASP) is Microsoft's first server-side scripting language and engine for dynamic web pages.
It was first released in December 1996, before being superseded in January 2002 by ASP.NET.
History
Initially released as an add-on to Internet Information Services (IIS) via the Windows NT 4.0 Option Pack (1996), it is included as a 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:
- ASP 1.0 was released in December 1996 as part of IIS 3.0
- ASP 2.0 was released in September 1997 as part of IIS 4.0
- ASP 3.0 was released in November 2000 as part of IIS 5.0
ASP 2.0 provides six built-in objects: Application, ASPError, Request, Response, Server, and Session. A Session
object, for example, represents a session that maintains the state of variables from page to page. The Active Scripting engine's support of the Component Object Model enables ASP websites to access functionality in compiled libraries such as dynamic-link libraries.
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 was supported until 14 January 2020 on Windows 7. The use of ASP pages will be supported on Windows 8 for a minimum of 10 years from the Windows 8 release date. ASP is supported in all available versions of IIS as of 2024.
Architecture
ASP uses scripting on the server to generate content that is sent to the client's web browser via HTTP response. The ASP interpreter reads and executes all script code between <% and %> tags, the result of which is content generation. These scripts were written using VBScript, JScript, or PerlScript. The @Language
directive, the <script language="language" 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 | Client Side |
---|---|
The server's current time: <% Response.Write Now() %> |
The server's current time: 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.
Sun Java System ASP (formerly ChiliSoft ASP) was a popular and reportedly complete emulator, but it has been discontinued.
The Server object
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.Swingbridge") %>
The Application object
This object stores global variables, which are variables accessible to all users.
<% Application("Ali") = "My ASP Application" Response.Write "Welcome to " & Server.HTMLEncode(Application("Ali")) & "!" %>
The Session object
Stores variables accessible only to a single visitor, which are local variables.
<% If Len(Request.QueryString("name")) > 0 Then Session("name") = Request.QueryString("name") End If Response.Write "Welcome " & Server.HTMLEncode(Session("name")) & "!" %>
The session object is file based and multiple concurrent read and/or write requests will be blocked and processed in turn.
The Err object
Allows the management and fixing of non-fatal errors.
<% On Error Resume Next Response.Write 1 / 0 ' Division by zero If Err.Number <> 0 Then Response.Write "Error Code: " & Server.HTMLEncode(Err.Number) & "<br />" Response.Write "Error Source: " & Server.HTMLEncode(Err.Source) & "<br />" Response.Write "Error Description: " & Server.HTMLEncode(Err.Description) & "<br />" Err.Clear End If %>
See also
- ASP.NET
- Template processor
- Comparison of web template engines
- Jakarta Server Pages
- PHP
- Common Gateway Interface
References
- The session data is kept server-side, the ID is saved as a HTTP Cookie. Source: ASP and Web Session Management, Microsoft
- ^ "Active Server Pages (ASP) support in Windows". Support (4.0 ed.). Microsoft. 30 January 2012. Retrieved 11 August 2015.
- Source: , Microsoft
- Weissinger, Keyton (6 October 2009). ASP in a Nutshell: A Desktop Quick Reference. O'Reilly Media, Inc. ISBN 978-1-4493-7959-9. Retrieved 9 October 2013.
External links
- ASP on MSDN
- Microsoft Support for ASP on Windows
- Classic ASP Applications on IIS 7.0 and IIS 7.5 Overview
- Primitive Classic ASP Framework (XML, JSON, BENCODE)
Web interfaces | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
| |||||||||||||||||
|