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>
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 |
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.