By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,576 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,576 IT Pros & Developers. It's quick & easy.

securityexception error trapping

P: n/a
Re: [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.


Following is a snippet of the code used

Public Sub Main()
'get system.environment variables if needed

Dim environmentVariables As Idictionary = _

Catch ex As System.Security.SecurityException

MessageBox.Show("Trap error here", _
"", MessageBoxButtons.OK, MessageBoxIcon.Error)
'terminate the program
End Try

Etc, etc

End sub
Feb 18 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.