Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Search Stardeveloper.com
Stardeveloper RSS Feed
Newsletter
Enter your email address below to be informed every time a new article is posted at Stardeveloper.com:

You can follow Faisal Khan on Twitter
Article Categories
.NET  .NET
  ASP (16)
  ASP.NET (41)
  ADO (16)
  ADO.NET (10)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)
Log In
UserName Or Email:

Password:

Auto-Login:

Miscellaneous Links
  Submit Article

Hosted by Securewebs.com
 
Home : .NET : ASP : Basic Active Server Pages Tutorial for beginners
 

<% and %> tags
Our ASP script resides between the <% %> tags. Any script between the <% %> tags is executed on the server while the rest of the HTML tags or script in an .asp page is not parsed and is sent to the client browser as it is. There can be any number of <% %> tags as we want. After executing the code between the <% %> tags, the output which is generated is sent to the client and never ever the ASP code itself.

Understanding ASP Objects
As I stated earlier there are six built-in ASP Objects available to you as an ASP developer. But what is an object ? Well an object is an instance of a Component which has methods and properties. I am not going to indulge into what Components are except that they are a compiled piece of code built in any programming language which offer you the ability to just create an instance of them ( create an object ) and start using their methods. ASP is so much powerful that not only it uses these six built-in Objects but can also call other applications or components like ADO to access databases and CDO for messaging applications. You can even build your own custom COM components and then call their methods from within ASP. This is ASP COM integration which gives ASP is so much power that no other server side scripting language can match.

Six Built-in ASP Objects
Following are the six Objects which are available to you without needing to create an instance of them and that's why they are called built-in Objects :

ASPError Object is new and is available only in Windows 2000. By clicking the above ASP Objects you can see the collections, properties, events and methods which are made available by each of these.

Object.method() Syntax
To start using them following is the syntax you should use :

Object.method()
Object.property

For example, recall that how we used Response.Write to output Hello World! to the client browser. In that case, Response was the name of the Object and Write was the name of the method that generated the output to the client browser.

<% Response.Write "Hello World!" %>

So you can use the methods and properties of the Objects by writing the Object name and then a dot and then appending the method or property name. Dot . is what separates the Object from the method or property. You must be wondering where have the opening and closing brackets ( ) gone in the Write method of Response Object, well in VBScript we don't type brackets in front of method name except in some cases. So that is why we just used Response.Write, that's why I say that VBScript is much more natural way of writing ASP pages and is the easiest of all languages.

Summary
In this tutorial we learned that Active Server Pages are simple HTML pages which can contain extra ASP script within the <% %> tags which is executed on the server and the output is sent to the client. We also learned that ASP consists of six built-in Objects and saw how easy it is to call an Object's methods and properties. We also came to know that ASP can call other COM Components and use their methods. We can even build our own COM Components and use their methods inside ASP. You can use the reference material available on this site to see the methods, properties, collections and events available to you in the six built-in ASP Objects.

Where to go from here ?
I would advise you to see the reference material ( see above ) and then test those methods and properties on your own as that is how you will learn them. In this way you will also be able to know that what is available to you in those six ASP Objects because those are the Objects you are going to use mostly in your ASP career.

<% and %> tags
Our ASP script resides between the <% %> tags. Any script between the <% %> tags is executed on the server while the rest of the HTML tags or script in an .asp page is not parsed and is sent to the client browser as it is. There can be any number of <% %> tags as we want. After executing the code between the <% %> tags, the output which is generated is sent to the client and never ever the ASP code itself.

Understanding ASP Objects
As I stated earlier there are six built-in ASP Objects available to you as an ASP developer. But what is an object ? Well an object is an instance of a Component which has methods and properties. I am not going to indulge into what Components are except that they are a compiled piece of code built in any programming language which offer you the ability to just create an instance of them ( create an object ) and start using their methods. ASP is so much powerful that not only it uses these six built-in Objects but can also call other applications or components like ADO to access databases and CDO for messaging applications. You can even build your own custom COM components and then call their methods from within ASP. This is ASP COM integration which gives ASP is so much power that no other server side scripting language can match.

Six Built-in ASP Objects
Following are the six Objects which are available to you without needing to create an instance of them and that's why they are called built-in Objects :

ASPError Object is new and is available only in Windows 2000. By clicking the above ASP Objects you can see the collections, properties, events and methods which are made available by each of these.

Object.method() Syntax
To start using them following is the syntax you should use :

Object.method()
Object.property

For example, recall that how we used Response.Write to output Hello World! to the client browser. In that case, Response was the name of the Object and Write was the name of the method that generated the output to the client browser.

<% Response.Write "Hello World!" %>

So you can use the methods and properties of the Objects by writing the Object name and then a dot and then appending the method or property name. Dot . is what separates the Object from the method or property. You must be wondering where have the opening and closing brackets ( ) gone in the Write method of Response Object, well in VBScript we don't type brackets in front of method name except in some cases. So that is why we just used Response.Write, that's why I say that VBScript is much more natural way of writing ASP pages and is the easiest of all languages.

Summary
In this tutorial we learned that Active Server Pages are simple HTML pages which can contain extra ASP script within the <% %> tags which is executed on the server and the output is sent to the client. We also learned that ASP consists of six built-in Objects and saw how easy it is to call an Object's methods and properties. We also came to know that ASP can call other COM Components and use their methods. We can even build our own COM Components and use their methods inside ASP. You can use the reference material available on this site to see the methods, properties, collections and events available to you in the six built-in ASP Objects.

Where to go from here ?
I would advise you to see the reference material ( see above ) and then test those methods and properties on your own as that is how you will learn them. In this way you will also be able to know that what is available to you in those six ASP Objects because those are the Objects you are going to use mostly in your ASP career.


Previous ( 1 Gone )( No Further Pages )

See all comments and questions (post-ad) posted for this tutorial.


Related Articles
  1. Server Side Email Addresses Validation using VBScript
  2. Sending E-Mails with ASP Pages
  3. Extremely useful ASP functions
  4. Uploading Files to the Server Hard Disk using plain ASP
  5. Object Oriented Design Principles in Visual Basic
  6. Beginning E-Commerce : Object Oriented Programming
  7. Professional Windows DNA
  8. An ASP Tutorial to create your own News Letter
  9. An ASP Tutorial to create your own Database driven Search Engine
  10. Connections, Commands and Procedures

Comments/Questions ( Threads: 12, Comments: 22 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

  1. REGARDING IIS DOWNLOAD ( 1 Reply )
  2. My Script does not work
  3. regarding IIS download ( 1 Reply )
  4. about visual basic in web
  5. search engine help!
  6. PLS Help with ASP form / mailer.
  7. personal web server for asp ( 2 Replies )
  8. I can't get this to work ( 1 Reply )
  9. It works & it Doesn't
  10. ASP Basics!!!! ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  11. Playing with the text!!!! ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  12. It does not work ( 3 Replies ) This thread contains 2 replies by the Author of this Article. This thread contains 2 replies by Faisal Khan.

Post Comments/Questions

In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed to.

 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.