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

Debugging

ADVANCED

STEP THRU
COMMON PROBLEMS

No data returned; No HTTP headers; or
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: (no headers listed)

This is usually caused by one or more missing DLLs. Without them, the server cannot even load the executable so it gets flushed before it has a chance to write out anything, not even an error message. This usually happens if the programmer is running the Visual Basic editor on a different machine from the web server. In this case, VB is not installed on the web server machine. This can be fixed by installing VB. If this is not an option, create a setup of your script by using the Setup Wizard that comes with VB and install that on the web server machine. This will install just the DLLs and other files needed to run the script written in VB.

Server is not responding.
The most common cause is an untrapped error. For a typical VB program, an error message pops up. When the user clicks OK, the program gets terminated. As a web application, the visitor does not get to see the message and there is no one at the web server to click OK. Some web servers can tell that the application is waiting for a user response so the server ends the application. One solution is to fix the error as described in Debugging. The ultimate solution is to trap all errors as described in Error Trapping. Another cause of this problem is deliberately popping up a message box or VB form. Such graphical user interfaces have no place in a web application since visitors cannot see them.
 

ERROR TRAPPING

An error trap in the Main procedure could be the most important part of a VBWeb application. Leaving it out is the most common mistake. In such a case, if an error occurs, the visitor never gets a response. With a trap, at least the visitor gets to see a generic error message. The error handler can be modified to produce a more suitable message. Deeper traps can be set for more specific handling. No error can slip by a trap in the Main procedure. Such a trap might look like this example:

Public Sub Main()
On Error GoTo Trap
Call LoadRequest
Call ProcessRequest
Exit Sub
Trap:
Call ErrorHandler("")
Exit Sub
End Sub
DEBUG LOG

One debugging technique is to write variables and intermediate values out as part of the web page. But you might not want others to see that. An alternative is to write to the Debug Log. This is done with the CgiDebugPrint instruction. It writes to a file with the same name as the script and in the same directory but with the extension LOG. For example:

C:\Webshare\Scripts\vbshop\vbshop.log
The log does not grow larger with each request. Instead, it only contains data from one request. CgiDebugPrint writes nothing unless IsCgiDebugOn is set to True.
 
top

ADVANCED

STEP THRU


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