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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS