Classic ASP file structure and first VBScript page

After installing IIS the web server let us start our first ASP page. Here we assume that ASP engine is working perfectly and server root is set to proper directory were we will keep our fist asp page. Here if the directory path is E:\myfiles\ and our first ASP file name is test.asp then the path becomes E:\myfiles\test.asp. To open this file in web browser mode we have to open this as
http://localhost/test.asp
or
http://127.0.0.1/test.asp
The exact physical directory depends on the IIS site configuration. Now create a first page named test.asp. Classic ASP server-side code is placed between <% and %>. The page can also contain ordinary HTML. For these tutorials we use VBScript and declare it with the page directive:
<%@ Language=VBScript %>
Use Option Explicit so misspelled or undeclared variables are caught instead of being created implicitly:
 <% Option Explicit %>
After this we will keep our html meta tags and then we will go to the body section of the ASP page. We will try to print the message �Hello World� to the screen. Here we will store this message string in a variable and let us name the variable as msg. Please note that we have told ASP engine that all the variables we use are to be declared before, this we have told in the second line of our code by saying <% Option Explicit %> . So we will declare the variable by using the command Dim. Here is the example
Dim msg 
msg="Hello World"
Now let us print the message or the variable to the screen by using Response.Write object.
Response.Write msg
That is our entire first ASP example. Here is the complete code.
<%@ Language=VBScript %>
<% Option Explicit %>

<html>
<head>
<title>(Type a title for your page here)</title>
</head>

<body >

<%
Dim msg
msg="Hello World"
Response.Write msg
%>

</body>

</html>

Loops and condition checking

If Else & ElseIF conditional program structure control in ASP
Matching options by using Select Case statement in ASP
Do While Wend Loops in ASP
For Next Loop in ASP

ASP Home






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer