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
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.