newman     VBWeb     VBSource     Portfolio    
OUT ON THE INTERNET


Home

Getting Started
- Hello World Example
- SampleMain Example
- Code Snippets
- Request Collection
- Missing Terms
- Multi-Select
- Names Collection

User Guide
- Debugging
- Stepping Through Code
- HTML Templates
- Cookies

Command Reference
- AddToRequest
- BackupRequest
- CgiDebugPrint
- ErrorHandler
- Escape
- Extract
- FileContents
- FileExists
- GetRequest
- GmtDate
- IsVBIDE
- LoadRequest
- Parse
- Redirect
- Replace
- Send
- SendLn
- ServerVariables
- SetCookie
- StandardIn
- UrlDecode
- UrlEncode

Appendix
- Web Server Directory Mapping
- Computer Name & IP Address

Reference

AddToRequest

Adds a Name/Value pair to the Request collection.
Syntax
AddToRequest Name, Value
Call AddToRequest(Name, Value)
Part
Description
Name Required text to be added to the Request collection as the key to Value.
Value Required text to be added to the Request collection.

Note: This command is not intended for public use so be careful. It is already called by the LoadRequest command.

Remarks
If more than one control in an HTML form has the same name, the browser will still send both in the request. That means a Name can have two Values. Therefore each item in the Request collection is actually a sub-collection of Values. If no sub-collection exists for the given Name, then a new sub-collection is started. If it is already there, then Value is added to that sub-collection.

BackupRequest

Saves the contents of the Request collection in a file.
Syntax
BackupRequest
Call BackupRequest
Remarks
The LoadRequest command will restore the backup if the VB project is run from within the VB development environment. There should be no need to call BackupRequest yourself since it is already called by the LoadRequest and ErrorHandler commands. To get LoadRequest to call BackupRequest, set IsCgiDebugOn to True before calling LoadRequest. Even then, LoadRequest will not call BackupRequest unless the VB project is run as an executable and not in the VB development environment.

BackupRequest has the same problems as any other server side file I/O. File I/O is slow and can cause a File I/O Error for other visitors. Therefore, you should use this command sparingly in production. You might want to check for your IP address before setting IsCgiDebugOn to True or calling BackupRequest yourself. That way, it will only get called if you are the user. There is a trick to this since your IP address is not in the Request collection until after LoadRequest gets called. See the example below.

The backup file gets the name in the REQUEST_BACKUP_FILE_NAME VB constant which is set to "Request.Bak" by default. The backup file gets saved in the current directory which is usually the directory the executable is in. The value in each Name/Value pair gets encoded with the UrlEncode command before it is backed up so that the value can contain special characters. Each Name/Value pair is in one line of the backup file.

See also: LoadRequest, ErrorHandler, and UrlEncode.

Note: This command is called by the LoadRequest and ErrorHandler commands.

Examples
This example demonstrates how to check for your IP address. Note that REMOTE_ADDR is blank if this code is run from the VB Development Environment. Const MY_IP = "256.256.256.256" If Environ(CGI_REMOTE_ADDR) = MY_IP Then IsCgiDebugOn = True End If Call LoadRequest This example calls BackupRequest under the very same conditions as the previous example except without the IsCgiDebugOn boolean variable. That way, LoadRequest can get called first. Call LoadRequest Const MY_IP = "256.256.256.256" If Request(CGI_REMOTE_ADDR) = MY_IP _ And Not IsVBIDE() _ Then Call BackupRequest End If


Copyright 1997 NEWMAN Services Corp. All rights reserved.
973-228-5753 pres@newmanservices.com