martin_vista
Active member
- Joined
- Mar 26, 2007
- Messages
- 29
- Programming Experience
- 3-5
The class clsCipher contains a method that reads an encrypted password from an ini files and decrypts it. The encryption and decryption work fine and have nothing to do with this question.
The problem is reading the .ini file. When I try this local, it is not a problem, but when I run the application from a share, it gives a security error. (my errors are in dutch, they are about System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral)
I know I should be able to solve this by setting policies, but the application I am building has to run in several different environments, I will not be allowed to change policies everywhere, so I'll need to find a solution in the code.
This is the code:
Dim myCipher As New rCipher.clsCipher 'the class is working fine
Dim filePerm As FileIOPermission
filePerm = New FileIOPermission(FileIOPermissionAccess.Read, Application.ExecutablePath)
txtPlain.Text = myCipher.GetPasswordFromIni(txtKey.Text, Application.ExecutablePath)
First I thought the Application.ExecutablePath was the problem, but when I point directly to the .ini file I get the same problem. I also found out that the following code gives exactly the same error:
Dim filePerm As FileIOPermission
filePerm = New FileIOPermission(FileIOPermissionAccess.Read, Application.ExecutablePath)
msgbox(Application,ExecutablePath)
All ntfs permissions are set correctly.
Does anyone know how to solve this?
The problem is reading the .ini file. When I try this local, it is not a problem, but when I run the application from a share, it gives a security error. (my errors are in dutch, they are about System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral)
I know I should be able to solve this by setting policies, but the application I am building has to run in several different environments, I will not be allowed to change policies everywhere, so I'll need to find a solution in the code.
This is the code:
Dim myCipher As New rCipher.clsCipher 'the class is working fine
Dim filePerm As FileIOPermission
filePerm = New FileIOPermission(FileIOPermissionAccess.Read, Application.ExecutablePath)
txtPlain.Text = myCipher.GetPasswordFromIni(txtKey.Text, Application.ExecutablePath)
First I thought the Application.ExecutablePath was the problem, but when I point directly to the .ini file I get the same problem. I also found out that the following code gives exactly the same error:
Dim filePerm As FileIOPermission
filePerm = New FileIOPermission(FileIOPermissionAccess.Read, Application.ExecutablePath)
msgbox(Application,ExecutablePath)
All ntfs permissions are set correctly.
Does anyone know how to solve this?