Flag This Hub

Programming.a.baby - (Asp) Writing my first Asp Page hello world

By


Article 2 (Asp)

In this Article i will gonna teach you how to write a simple Asp page the easy way i can.

If you need to test your Asp pages you have 3 choices:

  1. (Windows) Install or have an IIS web server
  2. (Linux) Install or to have Sun Java System Web Server 7.0
  3. (Web) Using a search engine to find, or having a free web host where you can upload your files


Making Your First Asp Page

  1. Open a NotePad Text empty document
  2. Save it as (all documets) "default.asp" using the notepad's menu and close it
  3. Edit the document you already saved by using one of these two methods
    • 1) Right clicking and selecting Edit (if you do not have an html's editor installed it will open with it, else it will open with notepad )
    • 2) Right clicking and selecting Open With and selecting Notepad

Note: Very Important ( DO NOT EDIT WITH MS WORD OR WORDPAD ) because it will change the document, we need only a Very Simple Notepad's Empty Document

Now we will start to write inside it.


Asp Enclosed Tags

When the web server verify your asp page it Will interpret everything inside the Asp enclosed Tags as Script and will compile it, take a look in the code sample bellow:

<%
'This is a comment and is inside the Enclosed Asp Tags
%>

You now know that each time you want to write a comment inside the Asp, you just need to start each line with an apostrophe ('), this way, all these lines won't be executed, and no one will read them.

Now, we want to write asp using the primary Language (VBscript),since we can use also Jscript is always a good thing to declare it, allways in the top of the page (no where else).

<%@ Language="VBScript" %>

<%
'You now have done the document Asp declaration
%>

Option Explicit

During your learning you will make several errors, and if we start doing the things right now, it will be better for the future.

So we will write another line of code called OPTION EXPLICIT, why we want this?

For now you may think it's a waste of time, but just the fact you have this inside your Asp web pages will help you later with your errors, because it will show you each VARiable that you wrote badly .

There are two conditions when you have this:

  1. It must be in top of the page after the Language declaration
  2. You will have to declare every single Variable you use (this is professional work)

Watch the example bellow:

<%@ Language="VBScript" %>
<% OPTION EXPLICIT %>

<%
'You now have done the document Asp declaration and the Explicit Option
%>

Sample 1

<%Response.Write "Hello World"%>

Sample 2

<%= "Hello World"%>

Response Write

You have two different ways for writing a phrase in Asp.

  1. The normal way is with (Response.Write) that you can use every where in the code as you can see in the Sample 1 at your Right
  2. If you only use one code line or if it's in the begin of the line, you can use (=) as you can see in the Sample 2 at your Right


First Page

For now we have a simple Asp page that you can already use

<%@ Language="VBScript" %>
<% OPTION EXPLICIT %>

<%
'You can copy this code and paste it int your page and test it in your web server

 Response.Write "Hello World"
%>

More Asp Articles

.

Next -->

Programming.a.baby - (Asp) Variables

|||

<-- Previous

Programming.a.baby - (Asp) What is it

.

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working