As with debugging client-side JavaScript, you will be faced with a variety of
syntax, runtime, and logical errors. Generally you eliminate the syntax errors, then eliminate
the runtime errors, and finally eliminate the logical errors.
If you get a "Page Cannot be Displayed" message in the browser, the problem of course could be the type of problem you are used to encountering with HTML -- a file hasn't been uploaded to the server, or to the right directory, or there is a spelling discrepancy. However, Internet Explorer, make sure you scroll down the "The Page Cannot Be Displayed" because you may find the ASP error message with line number, etc. So the page is being found, you are just getting a Page Not Found message at the top to be followed by the error message.
In Internet Explorer, but not Netscape 4.7 or 6.2, you may be able to eliminate the Page Cannot
be Displayed message -- select Tools, Internet Options, Advanced, uncheck the box "Show
friendly HTTP error messages".
When faced with runtime or logical errors, you may want to display the values of variables, or display a notification that the program got to a particular point. While you can use client-side JavaScript such as window.alert in an ASP page, that code will not be executed till all the ASP commands have been executed and the page sent to the browser. Thus this is not useful to debug ASP.
Response.Write is useful in display the values of variables or tracing program execution. However, if the program encounters a runtime error such as a variable not being defined, you will see the error message (e.g., "variable not defined") displayed in the browser, not the values of the variables from Response.Write or any of the HTML in the page.
What to do? Well, you need to eliminate the runtime error. For example, if you have an
undefined variable, go ahead and give the variable an arbitrary value before using it so as to
eliminate the error. This will allow your Response.Write statements to function and you may
then figure out why the variable is undefined.
If you are passing values from one page to another, and the second page isn't behaving as
expected, make sure that the values are in fact getting passed correctly -- either put in
Response.Write statements at the top of the second page or do another, but simpler, second page with
just Response.Write statements, and see whether you can pass values successfully to that.
Modified: May 4, 2002. Comments to William Pegram at wpegram@nvcc.edu