By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,865 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,865 IT Pros & Developers. It's quick & easy.

UnauthorizedAccessException writing HKCU key values

P: n/a
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.

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
----------------------
"RickH" <ri*****@tirnanog.com(do not spam)> wrote in message
news:D8**********************************@microsof t.com...
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.
Nov 21 '05 #2

P: n/a
That is the same code that I am using that gives me the unauthorized error.
WHy would my code be failing?
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.