ASP   «Prev  Next»

Lesson 11 Ways to write ASP scripts
ObjectiveCompare scripting alternatives for embedding programs in HTML.

Modern Scripting Alternatives for embedding programs in HTML 5

During the dot-com era, Classic ASP (Active Server Pages) was a popular server-side scripting technology used to dynamically generate web pages on Microsoft's IIS (Internet Information Services) servers. With the evolution of web development, several modern alternatives now offer more flexibility, performance, and compatibility for embedding programs in HTML5 web pages. Here is a comparison of some prominent technologies:
  1. PHP:
    • Similarity: Like ASP, PHP code can be directly embedded into HTML using special tags. It is interpreted on the server-side and is still one of the most popular languages for web development.
    • Advantages: PHP is open-source, widely supported, and has a vast ecosystem of frameworks and libraries (like Laravel, Symfony). It provides strong database integration capabilities and is relatively easy for beginners to pick up.
    • Disadvantages: PHP scripts can sometimes become unmanageable if not properly structured. It’s also facing competition from more modern frameworks that offer better performance and scalability.
  2. JavaScript (Node.js):
    • Similarity: While JavaScript itself is a client-side scripting language, Node.js allows it to be used on the server side, which can be integrated into HTML5 via various templating engines.
    • Advantages: JavaScript on both the server and client side can simplify the development process. Node.js offers high performance and scalability thanks to its non-blocking I/O model.
    • Disadvantages: Callback-based nature of Node.js can lead to complex code structures, famously dubbed as "callback hell," though this can be mitigated with modern features like async/await.


  3. Ruby on Rails:
    • Similarity: Ruby on Rails (RoR) provides embedded Ruby (ERB) that allows Ruby code to be embedded within HTML.
    • Advantages: RoR follows "Convention over Configuration" which makes it easy to set up and develop applications quickly. It offers a comprehensive default structure for web pages, databases, web services, and more.
    • Disadvantages: Ruby on Rails can be resource-intensive and might have a steeper learning curve due to its vastness and the Ruby language itself.
  4. ASP.NET:
    • Similarity: ASP.NET is the direct successor to Classic ASP, allowing scripts to be embedded in web pages, now using a more robust framework.
    • Advantages: It supports multiple programming languages (C#, VB.NET), integrates deeply with Windows infrastructure, and has excellent support for various programming models including MVC.
    • Disadvantages: Mostly tied to the Windows platform (though .NET Core is cross-platform), and the ecosystem can be quite complex for beginners.
  5. Python (Django/Flask):
    • Similarity: Python can be used for server-side web programming with frameworks like Django or Flask, integrating Python code in HTML through templating engines.
    • Advantages: Python’s syntax is clear and concise. Django and Flask offer scalability, rapid development, and robust security features.
    • Disadvantages: Python may not perform as well as JavaScript in browser-based scenarios due to its server-side execution nature.

Modern Trends and Best Practices
  • Single Page Applications (SPA): using Angular, React, or Vue.js offer client-side scripting solutions that communicate with server-side APIs, keeping the UI fluid and responsive.
  • API-First Development: Modern web applications often separate the backend (API server) and frontend (client-side), which is different from the embedded scripting approach but offers better scalability and flexibility.
  • Serverless Architectures: They allow developers to run code in response to events without maintaining a full server, reducing operational complexity and cost.

These modern approaches not only provide robust, scalable, and efficient ways to build web applications but also embrace the continuous evolution in web standards, browser capabilities, and developer tooling.


Purpose of Embedding Scripts

You could think of scripts as the glue that holds entire Web-based applications together. With scripts, you create not just a group of related pages in HTML, but applications that can:
  1. Verify that a (U.S.) zip code matches the city and state entered for an address
  2. Offer a choice of movies, and begin playing the selected movie as soon as the choice is made
  3. Choose the version of a Web page that is optimized for the user's particular browser and send it to them

You can create ASP scripts in any of several scripting languages from Microsoft or provided by third parties .
  • Versatile ASP Scripting:
    How can all these different scripting languages work smoothly with ASP?
    The answer is Microsoft's ActiveX Scripting standard. ActiveX Scripting is one of Microsoft's many ActiveX technologies. ActiveX Scripting says simply this: if you want to develop a scripting language, make sure it supports the standard, and Microsoft will guarantee that it works with Internet Explorer and ASP (among other things). Microsoft didn't decide to include Perl as a scripting language, someone else used ActiveX Scripting to add Perl capability.
  • ASP.NET
    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. Sun Java System ASP (formerly ChiliSoft ASP) was a popular and reportedly complete emulator, but it has been discontinued.
  • Legacy Scripting Languages:
    Microsoft distributes two different scripting languages with Internet Explorer and ASP:
    1. JScript and
    2. VBScript.
    JScript is Microsoft's implementation of a new, Web standard scripting language and looks similar to JavaScript. VBScript is a stripped-down version of Visual Basic, designed for Web scripting instead of building standalone applications. You can even script for ASP in Perl , a popular language in the Unix world that is frequently used for system administration and CGI programming. In the next lesson, you will put an interactive message into the course project.

PerlScript as an ActiveX Scripting language integrated with Classic ASP is deprecated

The technology PerlScript as an ActiveX Scripting language integrated with Classic ASP, can be considered deprecated in modern web development environments.
There are several reasons for this.
  1. Classic ASP: Active Server Pages (ASP) itself, while still supported on current versions of Windows for legacy purposes, has largely been superseded by ASP.NET and more modern web frameworks. Classic ASP was last updated around the early 2000s and has not received new features since then.
  2. ActiveX Technologies: ActiveX controls and scripting, including PerlScript, were heavily tied to Internet Explorer and Windows-specific technologies. With the phasing out of Internet Explorer and the move towards more secure and cross-platform web technologies, the use of ActiveX components has significantly declined. Modern browsers do not support ActiveX due to security and compatibility issues.
  3. PerlScript and ActiveState Perl: While ActiveState continues to provide Perl distributions for Windows (now known as ActivePerl), the specific integration of Perl as an ActiveX scripting language (PerlScript) for use with ASP is no longer a common practice. ActiveState has evolved to offer more modern tooling and language distributions that are aligned with current development practices.
  4. Modern Development Practices: Modern web development has shifted towards more universally supported technologies such as JavaScript/Node.js, PHP, Python, and Ruby, which do not require browser-specific or OS-specific components like ActiveX. This shift enhances security, portability, and maintainability.

While technically you might still be able to set up an environment where Classic ASP uses PerlScript on a Windows server with appropriate configurations, it would be a highly niche setup, primarily for maintaining legacy applications rather than for new development. For new projects, more current technologies and scripting languages are recommended.

SEMrush Software