11.05.07
The World’s Simplest ASP Script
ASP is a language that is very similar to PHP, the only difference being that PHP is more of an open source deal, while ASP is a proprietary language that is owned by Microsoft. This is why you will find a lot more Microsoft products supporting ASP languages and allowing you to shortcut through ASP languages, because of course the company is simply attempting to protect and even promote its own language. If you already have a working language of PHP, then you are likely to be able to assimilate ASP pretty quickly as well.
In order to help you do that, let us do what we have done for countless other programming languages; create the simplest script imaginable and then use it to explain the basics of the specific language in question. Before we do this though, we have to introduce you to the basic syntax rule when it comes to ASP. ASP files contain a combination of HTML tags, delineated by <> and , but they also contain ASP scripts, which are delineated by <% and %>. These scripts, like PHP scripts, are executed on servers and return results in HTML code based on what the scripts are designed for.
So, without further ado, here it is; the world’s simplest ASP script:
<%
response.write(“Hello World!”)
%>
There you have it; about as simple as anything can get. If you have already dealt with learning other languages, then you are already undoubtedly aware of the significance of the Hello World example. In this simple ASP script, the words Hello World will appear on screen followed by an exclamation point.
The parts of the script are quite simple, yet also quite effective in allowing us to examine the script more closely. The <% and %> lines are for starting and ending the ASP script and indeed are only on different lines in order to accentuate their presence as well as maintain the standard formatting for different lines of code (i.e. having the starting and stopping parts of the code occupy their own lines in simpler coding structures).
The response.write aspect of the script is the same as the echo or the _e parts of the PHP script in that they simply return a value that is put into the quotations inside the conventional brackets and in the case of this specific script that value happens to be Hello World! These are the basics of how ASP scripts work.
Scriptycan is a great software repository featuring both free and commercial ASP scripts and applications for developers and programmers.