Home         Back

 

 

 

Saivaneri Web Tutor

CHAPTER 10

ASP – ACTIVE SERVER PAGES 

ASP is a Microsoft’s answer to PHP of UNIX, Linux (called *nixes).

PHP means a recursive acronym for PHP –the Hypertext Preprocessor.

ASP is mostly used on Windows based servers, where as PHP on *nixes. 

Below is a sample ASP code for converting the local time to GMT time.

You can modify to your area/location time also. 

<%

Function BrinksterServerGMTOffset

                   Select Case trim(Request.ServerVariables("LOCAL_ADDR"))

                             Case "127.0.0.1"

                                      BrinksterServerGMTOffset = 5

                             Case "127.0.0.1"

                                      BrinksterServerGMTOffset = 5

                             Case Else

                                      BrinksterServerGMTOffset = 0

                   End Select

          End Function

 

          Function NowGMT

                   NowGMT = DateAdd("h", BrinksterServerGMTOffset, Now)

          End Function 

   strResponse = NowGMT

   Response.Write strResponse   

%>

ASP starts with <% …………ends with...........%>. The rest commands are exhaustive, we can write a 500 page book on that. So we will only concentrate on important commands and useful scripts. Most useful ASP scripts can be found at www.brinkster.com

In the above example 127.0.0.1 is the local machine (localhost) address. This is for example only. Use your own site IP address for conversion. 

ASP can be written in VBscript, or JAVAscript, or JAVA, or C# or J# or C++ or C. most people consider VBscript as the best one. 

Opening a CDROM with a VBscript ASP. 

<!—ending with --!> is also a valid ASP code identifier. It can be written within HTML also. 

<SCRIPT language=VBScript>

<!-- 

Set oWMP = CreateObject("WMPlayer.OCX.7" )

Set colCDROMs = oWMP.cdromCollection

 

if colCDROMs.Count >= 1 then

          For i = 0 to colCDROMs.Count - 1

                   colCDROMs.Item(i).Eject

          Next ' cdrom

End If

 

-->

</SCRIPT>

 In Chapter 15 we will see extensively how to use the ASP to power a FREE DATABASE website on www.brinkster.com we will be using a Microsoft Access Database at that site! So beautiful things are awaiting you at CHAPTER 15, wait a while!

 

PREVIOUS CHAPTER                 NEXT CHAPTER

FOR FULL CHAPTER PLEASE CLICK HERE