article

Intro to ASP syntax

Email
Submitted on: 1/5/2015 6:46:00 AM
By: Brad Hess from http://www.4aspdev.com (from psc cd)  
Level: Beginner
User Rating: By 7 Users
Compatibility: ASP (Active Server Pages)
Views: 293
 
     Attention ASP newbies! Looking to create your first ASP page? Check out this tutorial!

 
				

Let’s code our first ASP page. To do this write out the following code in your choice of development environment.

<HTML>
<
BODY>
<
B>Welcome to my webpage hosted on PWS!B>
<BR>The time is now: <%=Response.Write(TIME())%>
<
BR>
BODY
>
HTML>

Save the file in the c:\Inetpub\wwwroot\ directory on your machine and name it default.asp. Try accessing your website by opening a browser and typing http://127.0.0.1/default.asp or http://yourmachinename/default.asp. 127.0.0.1 is what is called the loopback address and is the TCP\IP address that points at your machine. The text: Welcome to my webpage hosted on PWS! should now show up. On the line under you should read "The time is now:" followed by the current time. Like this only without the Back link. If the time is showing up correctly you have a working ASP server running on your PC!. If the time does not show up correctly then something is wrong with the installation of personal web server

Now that we have an ASP page. Lets look at what is really happening when the page is requested. The code is as follows

<HTML>
<
BODY>
<
B>Welcome to my webpage hosted on PWS!B>
<BR>The time is now: <%=Response.Write(TIME())%>
<
BR>
BODY
>
HTML>

The code color syntax is the same as you will see in Interdev and Frontpage. Most of the code in this page is plain HTML, however the inside <% and %> is ASP code. The <% and %> seperates the HTML code from ASP code. The server recognizes the <% and %> and processes anything contained inside. Response.Write calls the Response Object that is part of the ASP object model. The write part of response.write calls the write method of that object. I will expand upon this more in the future. TIME() is recognized by the script engine as a function that retrieves the current time.

You just created your first dynamic website every time it is requested it will be updated with the current time on the server. While this is not really helpful it works well as an example.

See my next tutorial on the ASP object model to get a better idea of what all ASP supports.


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.