ASP Simple Scripts

In the gray boxes below, you will find some ASP code. This code has both ASP and HTML components. In the pink box I have the HTML code that your browser sees.

Today's date and time is: <% = now %>

Today's date and time is: 2/12/2012 1:52:15 PM

If you would like to have just the date, you can use the Visual Basic Long Date (vblongdate) format as below.

Today's date is: <% =formatdatetime(now(),vblongdate)%>

Today's date is: Sunday, February 12, 2012

The above scripting is being done with VBScript. As stated before, ASP is more a "container" than a scripting language. ASP can handle VBScript, JavaScript and Perl script. The newer ASP.NET can also handle versions of the C programming language.

You can also collect information about a visitor to your web site. Below is an example of this

Your IP Address is: <% =Request.ServerVariables("REMOTE_HOST")%>

Your Internet Browser is: <% =Request.ServerVariables("HTTP_USER_AGENT") %>


Your IP Address is: 38.107.179.209

Your Internet Browser is: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

There are many of these little scripts and an assortment of formatting options. You may visit the sites listed below to see examples.

http://www.hotscripts.com/ASP/Tips_and_Tutorials/Introduction_to_ASP

http://www.microsoft.com/windows2000/en/server/iis/htm/asp/asps4zar.htm

http://www.aspfree.com

http://www.4guysfromrolla.com

Using Forms

Home - What Is ASP - Simple Scripts - Using Forms - Form Elements - Form Processing - Session Variables - IF THEN ELSE