473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

UnauthorizedAccessException writing HKCU key values

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
2 4774
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Burton Roberts | last post by:
This is also posted in the security newsgroup. Sorry for cross-posting, but I'm desperate. I have a Winforms application in VB.NET with a SQL Server (MSDE) backend. In the root application...
4
by: ASP Yaboh | last post by:
I have app that writes text files to any location of the users choosing in the network. It has been working for 18months. An exception has begun occurring where a folder on a network share is...
4
by: Viviana Vc | last post by:
Hi all, A Windows service (which obviously starts before any user logs in) is failing to: - read something from registry from a key under the HKCU - try to find out the user path by doing the...
1
by: Robert Drozdz | last post by:
Hello everybody! There are many posts here concerning registry access and some derived problems. I couldn't find however any simple answer to this basic question: How can an impersonifited...
2
by: Michael Huhn | last post by:
I have a WebForm with several File-Inputs. On the server side I loop through the Request.PostedFiles and call a .SaveAs to a specific subfolder of my web. I get a System.UnauthorizedAccessException...
12
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files...
4
by: 101 | last post by:
I get a security error when trying to write out to an XMLSchema file "myDs.WriteXmlSchema(strXMLSchemaFile)". I am running XP SP2, No Domain, MS file and print sharing uninstalled. I was able to...
8
by: MSDN Account | last post by:
I have looked at the documentation for 'Microsoft.Win32.Registry' and 'System.Security.Permissions.RegistryPermission' but am still stuck, hoping some can give me a nudge in the right direction. ...
0
by: atx | last post by:
Hi, I have a web service, as I understand from msdn docs, web services in IIS 6 works with network service account. Therefore for a specific purpose, I have to access the HKCU registry of network...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.