RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB6,IIS4,IIS5
Expertise: Intermediate
Jul 10, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Don't use VB Registry functions in WebClasses and ASP components

Here's a scenario that might be familiar to you:
  • You create a WebClass or a regular COM component that will be invoked from within an ASP application
  • The application uses VB's built-in registry functions, such as DeleteSetting, SaveSetting, GetSetting, or GetAllSettings
  • Everything works when you debug the application inside the IDE
  • However, the application raises a runtime error when you compile it and use in the production system
Because the compiled application doesn't run in the interactive Windows desktop, you must go to the system Event Viewer to see the error message, which is Run-time error '5': Invalid procedure call or argument.

This isn't a bug, rather it's a consequence of how those registry functions use the registry. Visual Basic 6.0 Webclasses and ASP components run under the Internet Information Server service. SaveSetting, GetSetting, DeleteSetting, and GetAllSettings use registry keys in the HKEY_CURRENT_USER registry subtree, but the IIS service can't access the HKEY_CURRENT_USER registry subtree, and any attempt to do so will raise an error.

You can work around this problem by reading and writing to another area of the registry, such as HKEY_LOCAL_MACHINE or HKEY_USERS. You can use other functions in the Code Bank to do so.

Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date