Re: system.security.securityexception [CAS error message]
The program I have written [works just fine in the My Computer Zone]
requires "Full Trust" to run and will throw a security exception if a user
tries to load it while working in the Intranet Zone, i.e., on a LAN.
I am trying to trap the error, and advise the user via a messagebox to
request the LAN administrator to set up the user machine to allow "full
trust" thus permitting the code to run.
The code [below] works fine, traps the error [a call to get system
environment info] and generates the messagebox as expected, however, when
the user clicks OK to continue, the "End" program statement results in the
user's CAS generating the same error message all over again
[An unhandled exception of type 'System.Security.SecurityException' occurred
in . ].
How do I just terminate the program without generating a second exception of
the same type.
Does anyone have a clue as to how to fix this.
Mike
Following is a snippet of the code used
Public Sub Main()
'
'get system.environment variables if needed
'
Try
Dim environmentVariables As Idictionary = _
environment.GetEnvironmentVariables()
Catch ex As System.Security.SecurityException
MessageBox.Show("Trap error here", _
"", MessageBoxButtons.OK, MessageBoxIcon.Error)
'
'terminate the program
'
End
'
End Try
Etc, etc
End sub