V
Vernon Peppers
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(ByVal ValueName As String, ByVal TestValue As
Boolean)
Dim f As New RegistryPermission(RegistryPermissionAccess.Read Or
RegistryPermissionAccess.Write, "HKEY_LOCAL_MACHINE\Software")
Application.CommonAppDataRegistry.SetValue(ValueName, TestValue)
End Sub
I receive the following error whenever I try to run the program:
Unhandled Exception: System.Security.SecurityException: Request for the
permission of type System.Security.Permissions.RegistryPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 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(ByVal ValueName As String, ByVal TestValue As
Boolean)
Dim f As New RegistryPermission(RegistryPermissionAccess.Read Or
RegistryPermissionAccess.Write, "HKEY_LOCAL_MACHINE\Software")
Application.CommonAppDataRegistry.SetValue(ValueName, TestValue)
End Sub
I receive the following error whenever I try to run the program:
Unhandled Exception: System.Security.SecurityException: Request for the
permission of type System.Security.Permissions.RegistryPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
I am an administrator on my computer, so that can't be the problem. What am
I doing wrong?