I have a .net 2.0 app that I developed in VisualStudio2005. It works fine when I run the exe locally on a workstation with WinXP SP2. But if I try to run the same app off of a network share on my local intranet, I get the following error (excerpt):
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Windows.Forms.Application.Exit(CancelEventArgs e)
I found some info online which recommended that I run the following on the cmd line at the workstation:
caspol -m -cg LocalIntranet_Zone -allcode FullTrust
The above worked although I got a subsequent error (outlined farther below). Even if it had worked completely, Im not sure my data-security department will allow me to run this on all clients that need to access the exe. Id like to limit it to trust just to a particular network share (e.g. \\aserver\ashare$).
Second, even after I ran the caspol on the workstation, my code runs, but then I throw a subsequent error when trying to READ an environment variable. Here is my vb.net code
strFilePath = Environment.GetEnvironmentVariable("AnApp_CONFIG").ToUpper
Using .net 2.0, how do I configure the workstations so that they a) can run an executable on a network share and b) they allow that network-executable to read their local environment variables?