samsmithnz
Well-known member
I have a vb.net app that I am trying to run across the network. When the application starts it reads some registry values to get a connectionstring. The problem I am having is that it works when you run it on my desktop, and it works when you run it on the server, but when I try to run the server version from my desktop, I get this error:
I dont understand why!?! Im running it on my desktop with my desktop cpu, so Id assume that its in my desktops memory and is trying to access my desktops registry - which I have permission to do.
What is happening here???
Here is my registry code
Code:
"System.Security.SecurityException: Request for the permission of type System.Security.Permissions.RegistryPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name)
at ExchangeRates.modMain.ReadRegistrySettings() in C:\Projects\ExchangeRates\modMain.vb:line 87"
I dont understand why!?! Im running it on my desktop with my desktop cpu, so Id assume that its in my desktops memory and is trying to access my desktops registry - which I have permission to do.
What is happening here???
Here is my registry code
Code:
Read in the registry settings required for the application
Private Function ReadRegistrySettings()
Dim objRegistryKey As Microsoft.Win32.RegistryKey
Dim strLocation As String = "SOFTWARE\CurrencyExchange"
objRegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strLocation)
get the connectionstring information for the SQL Server
strConnectionString = objRegistryKey.GetValue("SQLConnString")
objRegistryKey.Close()
End Function
Last edited by a moderator: