ASP Basics
3-c: All About ArraysAnd now for a new way to store information .. arrays. Arrays are a very handy storage method. Think of arrays as variables on steroids. Imagine you wanted to store 20 different people's last names in variables. It would be quite a pain to create and keep track of strLastName1, strLastName2, etc. Not very efficient, right? That's where arrays come in. With an array you can create one variable that will have 20 slots, one for each person's name. Here is how |
|
4-a: Do the MathEven though you probably won't be doing much serious math in most of your ASP applications, it's still a good idea to review some of the more common math functions. Being that as it may, here are the more common VBScript mathematical functions: |
|
4-b: Messing with StringsLet's move on to some string functions. You will probably find yourself using string functions infinitely more than the mathematical functions above. The reason is that most of the data you interact with on the web is in the form of strings, i.e. people's names, addresses, web URL's, e-mail addresses, etc. Here are some of the most commonly used string functions. I have tried to give an easy to understand example of each function. We'll discuss the practical applications of some of the functions later. Here they are: |
|
4-c: Nailing Down a Date & TimeYou probably won't find yourself manipulating dates and times as much as strings but you will use these functions quite a bit. Here are some practical uses for the functions above: |
|
5-a: Response.Write: Talking to the UserYou will probably find yourself using Response.Write more than anything else in ASP. It is used to send output to the browser for the user. You will also find that you will use Response.Write frequently when debugging your pages and applications. So, how does it work? |
|
5-b: Response.Redirect: Moving the User AroundResponse.Redirect is kind of like a call forwarding button. It sends the user on to any location you designate. The syntax is virtually the same as Response.Write. Instead of entering a word or phrase that you want to be sent to the browser, you enter the URL of the destination that you want the user to be redirected to. For example: |
|
5-c: Response.Cookies: Memorizing Stuff About the UserCookies, as you probably already know, are small files that are stored on the user's computer. They are used by web developers to store all sorts of basic information such as names, dates, preferences, ID numbers, etc. |
|
5-d: Request.Cookies: Getting Stuff Out of a CookieAs promised, we will continue the practical example from the last lesson by retrieving information from our cookie and displaying the number of days since the person's last visit. I'll give you the code and then we'll take a look at how it works: |
|

