I am a newbie with .NET, trying to step up from VB6. I have a need to write
to and read from the registry. Config files will not be acceptable due to
their lack of security. The registry entry will have to do with the proper
registration and purchase of the program. I have the following code in my
program:
Public Sub SetRegValue(ByV al ValueName As String, ByVal TestValue As
Boolean)
Dim f As New RegistryPermiss ion(RegistryPer missionAccess.R ead Or
RegistryPermiss ionAccess.Write , "HKEY_LOCAL_MAC HINE\Software")
Application.Com monAppDataRegis try.SetValue(Va lueName, TestValue)
End Sub
I receive the following error whenever I try to run the program:
Unhandled Exception: System.Security .SecurityExcept ion: Request for the
permission of type System.Security .Permissions.Re gistryPermissio n, mscorlib,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9 failed.
I am an administrator on my computer, so that can't be the problem. What am
I doing wrong?
to and read from the registry. Config files will not be acceptable due to
their lack of security. The registry entry will have to do with the proper
registration and purchase of the program. I have the following code in my
program:
Public Sub SetRegValue(ByV al ValueName As String, ByVal TestValue As
Boolean)
Dim f As New RegistryPermiss ion(RegistryPer missionAccess.R ead Or
RegistryPermiss ionAccess.Write , "HKEY_LOCAL_MAC HINE\Software")
Application.Com monAppDataRegis try.SetValue(Va lueName, TestValue)
End Sub
I receive the following error whenever I try to run the program:
Unhandled Exception: System.Security .SecurityExcept ion: Request for the
permission of type System.Security .Permissions.Re gistryPermissio n, mscorlib,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9 failed.
I am an administrator on my computer, so that can't be the problem. What am
I doing wrong?
Comment