First ASP Script
You can write ASP scripts the same way you write HTML code. You don't need expensive tools or professional programming environment; you only need the most basic text editor in the world - Notepad - which can be found in any Windows version. Just like a HTML document, ASP files are made out of plain text. So let's give it a try. Click on Start, point to Programs, Accessories, than click on Notepad. Presto! Now type in the following text:
<html>
<body>
<%
Response.Write("Hello World!")
%>
</body>
</html>
That's it! Save the file to your "Inetpub\wwwroot\" folder, and give it an easy to remember name - "hello.asp". ASP files use the ".asp" extension, so remember to include this. To take a look at the output of the file, point your web-browser to "http://localhost/hello.asp". Now try to view the source of the document - right click somewhere on the page, and then click "View Source". You will not see the ASP source code, because your web-browser didn't receive it.
This way you can figure out for yourself that the web-server parses the text within the ASP tags - "<% (…) %>" - and leaves the rest of the HTML code untouched. While the previous example was made out of both HTML and ASP code, you can choose to use only ASP code:
<%
Response.Write("<html>")
Response.Write("<body>")
Response.Write("Hello World!")
Response.Write("</body>")
Response.Write("</html>")
%>
Save this file under the name "hello2.asp", in the same folder. Again, if you try to view its source after you have opened the file with your browser - "http://localhost/hello2.asp" - you will not see any ASP code. In fact, you will see the same HTML code as the previous "hello.asp".
There are two approaches to ASP scripting: VBScript or JScript. VBScript is the default scripting language, so you don't have to inform ASP that you're using it. But if you want to use JScript as the default language, you must insert a language specification at the top of the page:
<%@ language="javascript"%>
<html>
<body>
<%
Response.Write("Hello World!");
%>
</body>
</html>
While this might look the same at first, it's a complete different language. But the most important thing about it is that, unlike VBScript, JavaScript is CaSe SeNsItIvE. This means "Write" is not the same as "write", so you should really pay attention to your code.
The VBScript and JScript (which is Microsoft's implementation of JavaScript) languages are included in ASP, so you don't have to install any extra components. On the other hand, if you want to use another scripting language - for example Perl, REXX or Python - you will have to a script engine to handle that specific language.
1 Comment so far
Leave a reply


Bas de Baar, blogging as "The Project Shrink", is taking his message to the International Project Management community with a vengeance: "Projects Are About Humans. Now Deal With That!" ...
ple tell me about
how to insert password to connection thru database values