Active Server Pages

Mellor: ASP-Learning by Example.

FAQs

Question

Comment

How do I send e-mail? I am working on NT4 and lack a PERL interpreter, so I can't use Formmail Don't worry, this is very easy. You can use seveal methods, but most used is CDO. CDO stands for Collaboration Data Objects and is a pre-given functionality in ASP2+. Unfotunately the code is a bit long for a FAQ page, so I would advise you to go to a standard developer web site like www.asp101.com
The Northwind database provided under web-support is Access/Office version 95, can I convert it to XP? The answer is in two parts, using an Access XP on a non-XP platform, and using any Access version on an XP platform.

Access XP. Keep a back-up in 95, then try, but be aware that it is impossible to keep track of the conflicts provoked by all possible combinations of versions.

So if you encounter problems, revert to the 95. This is because you should concentrate on ASP and not get sidetracked by Access technicalities.

XP Platform. Various people have reported that IIS does not function properly on XP. So keep checking microsoft.com, but use a different platform until they fix the bug.

I am using an ASP Content Management System. Somehow the values I call up out of the database often end up in the wrong place, but I am not getting any error messages! This may have something to do with On Error Resume Next
This tells the ASP script interpreter to continue with the next statement and not to stop if it receives an error during script execution.
It could well be that in your CMS, this is on by default. You can check this by looking in your Global.asa file. The workaround is simple, instead of using On Error Resume Next in debugging, leave the default value as on, and instead turn it off in the page you want to debug. This uses:

On Error Goto 0

I'm having trouble with buffering, have you any advice?

In ASP2 buffering is by default set to off, but in ASP3, the default is on. Confusing isn't it?

Furthermore, if you try to set the the buffer property before the language declaration, an error will be generated. Therefore try:

<%@ Language="VBScript" %>
<%Response.Buffer="true" %>
<HTML>
etcetera . . .

Why is pure ASP slower than ASP with Visual Basic middleware? You should check the Afterword part of the web-support. ADO connection objects are expensive in terms of computer processor cycles. In advanced cases an Active X DLL (dynamic links library) file is used to tell Visual Basic where an objects methods and properties are. This is simply faster than pure ASP, where IIS checks all ASP objects without DLL help.
I get Permission Denied. Is the database writable ? Find it in Explorer, command (right) click, choose Properties > attributes and remove write protection.

The next thing to check is that the table is not open in Access. I know that it is good to have the database open, so you can check changes immediately, but close the table. You cannot have the table (as opposed to the database) open in Access and change it in ASP at the same time.
I still get Permission Denied

Servers also like to keep objects open. If it is locked open, this will also result in a Permission Denied error. If you have PWS and Visual C++, then use the Visual C++ Process Viewer to kill INETINFO.EXE. If you have NT, then open Notepad and write:

NET STOP IISADMIN
NET START W3SVC

(if you are using NT Workstation, stop here, but on NT Server keep writing)

NET START MSFTPSVC
NET START SMTPSVC

Save the file as restart.bat somewhere convenient and run it as needed.

If the above options do not apply to you, then boot (or reboot) the computer.

I get a Runtime Error 800a01ad.

 

This is also a permissions failure.

Locate the file, right-click and select Properties > Security > Permissions. Select Add. Go to IIS Anonymous User > Types of Access = Full.

Try again.

I declare my variable as "Currency", but I get the wrong currency

IIS returns the currency according to the version, so a US version will return with a dollars sign attached etc. To fix this, use the following (or similar) function.

Function FormatPrice(price)
FormatPrice= "£ " & FormatNumber(price, 2)
End Function

Call this using:

Response.Write FormatPrice(price)

My INC – included files — don’t work

If you have:

<@ Language=VBScript >

in the INC file, then it will provoke an error, because in the original file it will not be read as the first line.

The INC files still don’t work

Check their location. If they are not in the same directory, then copy them over, correct the path in the code, and try again.

Some programmers say that INC files should be in the same directory to work properly. I don’t know why that should be true; it may be that on different platform versions, a version conflict is present.

The INC files still don’t work If you are running a non-US platform, look under System > Windows System and install "support more languages." Reboot.
 


Return to overview