If you are just a beginner and studying in the field of computer programming, you will encounter ASP and VBScript, but what exactly are the differences between the two? What is ASP?
ASP stands for Active Server Pages. It is a server side technology that enables you to make dynamic and interactive web pages that are not affected by the type of browser the web site visitor is using. Actually, ASP pages are scripts that are run, or executed, on the web server. The script is interpreted from top to bottom to create HTML pages that are sent to the browser for display. ASP is usually run on Microsoft web server, Internet Information Server (IIS). It is this web server that ASP pages usually run best on. IIS or its micro version Personal Web Server (PWS) comes free with windows. However, there are products available, such as Chili! Soft ASP, which enables ASP to be used on other web servers, using various operating systems including, Linux, Solaris, HP-UX, AIX, etc. What languages can you use to program in ASP? ASP is a scripting technology, and it is language-independent. Two of the most common scripting languages are supported right out of the box - VBScript and JScript (Microsoft's version of JavaScript). Support for other scripting languages, such as Perl, is also available. However, the more common language used for writing ASP is VBScript. It is a Microsoft scripting language based on Visual Basic. VBScript isn't very different from using VB in applications, or VBA in Microsoft Office. What can you do with ASP? ASP is appropriate whenever you want your pages to be created dynamically when the browser requests the page. For example, you can display dates, times, and other information in different ways. You can make a survey form and ask people who visit your site to fill it out, send emails, save the information to a file, etc. Often, the ASP scripts will query a database and format the data retrieved for display on a HTML page. Essentially, ASP is a server-side scripting technology. This means it allows for both HTML and a scripting language to be interspersed in a Web page. The scripting language might access the file system, or registry or database, and will generate HTML code 'on the fly' to make Web sites dynamic and user-specific. What is VBScript? VBScript (short for Visual Basic Scripting Edition) is an Active Scripting language, developed by Microsoft, which uses the Component Object Model to access elements of the environment within which it is running (e.g. File System Object or FSO used to create, read, update and delete files). The language's syntax reflects its origins as a limited variation of Microsoft's Visual Basic programming language. A VBScript script must be executed within a host environment, of which there are several provided with Microsoft Windows, including Windows Script Host (WSH), Internet Explorer (IE), and Internet Information Services (IIS). Additionally, The VBScript hosting environment is embeddable in other programs, through technologies such as the Microsoft Script control (msscript.ocx). What are the uses of VBScript? When employed in Microsoft Internet Explorer, VBScript is similar in function to JavaScript, as a language to write executable functions that are embedded in or included from HTML pages and interact with the Document Object Model (DOM) of the page, to perform tasks not possible in HTML alone. Other web browsers such as Firefox and Opera do not have built-in support for VBScript. This means that where client-side script is required on a web site, developers almost always use JavaScript for cross-browser compatibility. Besides client-side web development, VBScript is used for server-side processing of web pages, most notably with Microsoft Active Server Pages (ASP). The ASP engine and type library, asp.dll, invokes vbscript.dll to run VBScript scripts. VBScript that is embedded in an ASP page is contained within <% and %> context switches. The following example of an ASP page with VBScript displays the current time in 24-hour format (Note that an '=' sign occurring after a context switch (<%) is short-hand for a call to Write () method of the Response object). <% Option Explicit %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>VBScript Example</title> </head> <body> <div><% ' Grab current time from Now() function. Dim timeValue timeValue = Now() %> The time, in 24-hours format is <%=Hour(timeValue)%>:<%=Minute(timeValue)%>:<%=Second(timeValue)%>. </div> </body> </html> VBScript can also be used to create applications that run directly on a person's computer running Microsoft Windows. The simplest example of this is a script that makes use of the Windows Script Host (WSH) environment. Such a script is usually in a stand-alone file with the file extension .vbs. The script can be invoked in two ways. Wscript.exe is used to display output and receive input through a GUI, such as dialog and input boxes. Cscript.exe is used in a command line environment. VBScript .vbs files can be included in two other types of scripting files: .wsf files, which are styled after XML; and .hta files, which are styled after HTML. .wsf files can be executed using wscript.exe or cscript.exe, just like .vbs files, and .wsf files can include multiple .vbs files. As a result, .wsf files provide a means for code reuse: one can write a library of classes or functions in one or more .vbs files, and include those files in one or more .wsf files to use and reuse that functionality in a modular way. Another employment of VBScript is the HTML Application, or HTA (file extension .hta). In an HTA, HTML is used for the user interface and a scripting language such as VBScript is used for the program logic. HTAs run inside of mshta.exe, which is a 'Trusted Application Environment' provided by Internet Explorer. The 'Trusted Application Environment', implies that HTAs do not suffer the restrictions applied to applications running in the web or intranet zone, such as accessing local files or network paths. Although HTAs run in this 'trusted' environment, querying Active Directory can be subject to Internet Explorer Zone logic and associated error messages. VBScript (and JScript) can be used in a .wsc file to create a Windows Script Component - an ActiveX-enabled script class that can be invoked by other COM-enabled applications.
0 Comments
Leave a Reply. |
PLACE YOUR ADS HERE Join and Subscribe to my Newsletter. It's FREE! ABOUT THE
BLOGGER Hi, I'm Ralph Gregore Masalihit! An RFP Graduate (Registered Financial Planner Institute - Philippines). A Personal Finance Advocate. An I.T. by Profession. An Investor. Business Minded. An Introvert. A Photography Enthusiast. A Travel and Personal Finance Blogger (Lakbay Diwa and Kuripot Pinoy). Currently, I'm working my way toward time and financial freedom. Follow me on FACEBOOK x PLACE YOUR ADS HERE PLACE YOUR ADS HERE Categories
All
Archives
March 2025
|