Basic file structure of ASP

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



Note that in IIS we have set the default directory to E:\myfiles\

Now with this settings let us go for our fist file test.asp

We will start with our ASP code beginning mark <% and end the code with %> . This way we will tell our ASP engine to execute the ASP part of the code within the <% and %> symbol and send the other codes as it is to the browser. So we will start with telling the server that the code we are going to use is VB Script. ASP is not a script or language , it is a technology server uses. So we have to tell the server which language we are using. We can also use JavaScript as server side script. But mostly VBScript is used for server side scripting requirements and we will also use this. Here is the way we will tell to use VBScript language for processing.

<%@ Language=VBScript %>

In the next line we will tell that all the variables used here are to be declared before using. This has some advantage as we move to words developing complex applications using ASP. This is a good practice to follow. So here is our next line

<% 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’s our entire first ASP example. Here is the complete code.

<%@ Language=VBScript %>
<% Option Explicit %>

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

<body >

Dim msg
msg="Hello World"
Response.Write msg


Be the first to post comment on this article :


Post Comment This is for short comments only. Use the forum for more discussions.

Subscribe to our mailing list

* indicates required
Subscribe to plus2net
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2016 All rights reserved worldwide Privacy Policy Disclaimer