Web Service -> ActiveX DLL -> RegOpenKeyEx -> NO ACCESS!!!

  • Thread starter Thread starter sdz602
  • Start date Start date
S

sdz602

HI, here is my problem.

Basic C# web service is referencing an ActiveX DLL written in ATL C++.
This DLL is simply trying to read some settings from the registry under
the HKEY_CURRENT_USER section. However RegOpenKeyEx is failing with error
code 2 "The system cannot find the file specified."

Now I have tried all sorts of permission settings -

1. Giving ASPNET account (aspnet_wp.exe) "act as OS" privilege
2. Putting ASPNET account in Administrators group.
3. Changing the <processModel> setting to 'username=system' in machine.config
4. Giving ASPNET account access to the HKEY_CURRENT_USER section through
the regedit.exe, permissions.
5. Giving my web service the ASPNET account as its authentication control

Not sure there are many more things I can try. I've exhausted Google.

Please help!
 
you can try to set impersonate at logon or something like this

why can't you just use HKEY_LOCAL_MACHINE?
 
Hello

I don't think your problem is a permissions problem, I think the key you are
trying to access doesn't exist (so the error is "The system cannot find the
file specified." )
Any windows HKEY_CURRENT_USER key has user specific settings, belonging to
the current logged on user. So the Adminstrator's HKEY_CURRENT_USER has
totaly different content than ASPNET's HKEY_CURRENT_USER.

If you want to put a machine wide setting put it in HKEY_LOCAL_MACHINE. If
you want your web service to access Administrator's settings, use
impersonation to make your web service run as Administrator instead of
running as ASPNET

Best regards,
Sherif
 
Spot on Sherif,

thanks a bunch!!

Mark. :)


Sherif ElMetainy said:
Hello

I don't think your problem is a permissions problem, I think the key you are
trying to access doesn't exist (so the error is "The system cannot find the
file specified." )
Any windows HKEY_CURRENT_USER key has user specific settings, belonging to
the current logged on user. So the Adminstrator's HKEY_CURRENT_USER has
totaly different content than ASPNET's HKEY_CURRENT_USER.

If you want to put a machine wide setting put it in HKEY_LOCAL_MACHINE. If
you want your web service to access Administrator's settings, use
impersonation to make your web service run as Administrator instead of
running as ASPNET

Best regards,
Sherif
 
Back
Top