How to Start Programming in ASP

Starting to Write Active Server Pages

ASP - server site code - Mark Alexander Bain
ASP - server site code - Mark Alexander Bain
ASP (Active Server Pages) is a Microsoft technology that can be used to build dynamic web pages. This How to shows how to get up and running with ASP ASAP.

There are two things to remember when creating an ASP (an Active Server Page):

  • ASP is a technology, not a programming language
  • all of the action takes place on the server, not the user's pc

So, before creating an ASP it may be worth looking at those two points in a little more depth.

ASP is a Technology, not a Programming Language

Many people believe that ASP is a programming language - it's not; it is piece of software that sits on the server and interprets the scripting languages; for example, it is possible to use:

  • Javascript
  • PerlScript
  • VBScript

Interestingly it is actually possible to mix and match scripting languages in the same ASP web page.

All the Action Takes Place on the Server, not the User's PC

Javascript and VBScript can be used in any web page, and if they are then the code is downloaded to the user's computer and then run by the browser; however, there can be problems with doing this:

  • Firefox will only run Javascript
  • Internet Explorer will run either Javascript or VBScript, but it's interpretation of Javascript is slightly different to Firefox's

The solution is to run everything on the server, not the client (the user's pc); if web site developers run all of the code on the server then they can guarantee that the code will run, and they only need return the results of any processing to the user - hence ASP.

Of course, there is another advantage to using ASP - all of the code is hidden and all that the user sees is the output from the script. However, there is a potential disadvantage to be aware of - if the server is doing all of the processing then there is the possibility of it becoming overloaded, especially if the web site becomes very popular.

All Servers are not Created Equal: Does My Server Support ASP?

ASP is a Microsoft technology, and so one might expect ASP to be only available on Microsoft web servers with IIS (Internet Information Services) and normally that is the case; however, there are solutions for anyone with Linux servers:

Of course, the easiest answer may be to choose a suitable ISP (Internet Service Provider) and let them do all of the hard work.

Choosing an Editor

Once the web server has been set up, or arrangements made with an ISP, then consideration can be given to the ASP itself - and for this the developer will only need a text editor. Editors such as Notepad on Windows or Emacs (even Nano or Pico) on Linux will suffice, but it's worth looking into editors such as Notepad++ which have benefits such as:

  • syntax highlighting - this can aid when writing code (by highlighting key words)
  • FTP (File Transfer Protocol) which means that files can be uploaded directly to a web server

Notepad++ even has a word count function (see The Notepad++ Word Count).

Writing an ASP

The ASP itself can be a mixture of scripting languages; in this case Javascript and VBScript are used in the same page:

<SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
function SayHelloJavascript() {
return "Hello, I'm a JavaScript function";
}
</SCRIPT>
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Function SayHelloVBScript
SayHelloVBScript =" Hello, I'm a VBScript function"
End Function
</SCRIPT>
<%
Response.Write(SayHelloJavascript() & "<BR>")
Response.Write(SayHelloVBScript & "<BR>")
%>

The code can now be saved (via the editor's FTP functionality) to the server and then called from a web browser, for example:

http://<My Web Server>/Hello.asp

Conclusion

So, remember:

  • ASP is a technology, not a programming language
  • all of the action takes place on the server, not the user's pc

Any web designer with access to that technology has a very powerful tool at their disposal.

Mark Alexander Bain - Mark Alexander Bain is a writer, Mo Bro and consultant for all aspects of software development at dsquared. He has also written regularly ...

rss
Advertisement

Comments

Jan 3, 2009 4:09 AM
Guest :
Thanks
Jan 19, 2009 6:13 PM
Guest :
best 1
Oct 1, 2009 3:58 AM
Guest :
thanks
Nice Work..
Oct 8, 2009 1:46 PM
Guest :
Great article! Straight forward and to the point without insulting my intelligence. High marks to Mark Alexander Bain. Keep up the great work. I am now 10 minutes smarter than I was before reading this article. Again thanks. :)
Oct 9, 2009 4:36 AM
Guest :
Thanks Its Great.
5 Comments
Advertisement
Advertisement