UnauthorizedAccessException writing HKCU key values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

System.UnauthorizedAccessException
Cannot write to the registry key.
Is what I get trying to write a value in a HKCU\Software key.
My InfoPath form is fully trusted.
I have full permissions on the key according to Regedit permissions
Using vb.net 2003
For that matter, a Windows form I created doesn't allow me to delete a key,
and I can't write a key value in my Outlook com add-in, either.
Account has admin priviledges.
I guess I have been only reading keys, not writing them since vb6.
I've got to be missing something obviuos.
 
Hi,

This works changing OpenSubKey("Software\Ken", True) to
OpenSubKey("Software\Ken") will cause and UnAuthorizedAccessException.


Dim myReg As RegistryKey = Registry.CurrentUser
Dim MyRegKey As RegistryKey
Dim MyVal As String

MyRegKey = myReg.OpenSubKey("Software\Ken", True)
MyRegKey.SetValue("MyData", "test entry")
MyVal = MyRegKey.GetValue("MyData")
Trace.WriteLine(MyVal)

MyRegKey.Close()


Ken
----------------------
System.UnauthorizedAccessException
Cannot write to the registry key.
Is what I get trying to write a value in a HKCU\Software key.
My InfoPath form is fully trusted.
I have full permissions on the key according to Regedit permissions
Using vb.net 2003
For that matter, a Windows form I created doesn't allow me to delete a key,
and I can't write a key value in my Outlook com add-in, either.
Account has admin priviledges.
I guess I have been only reading keys, not writing them since vb6.
I've got to be missing something obviuos.
 
That is the same code that I am using that gives me the unauthorized error.
WHy would my code be failing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top