System.Security.Permissions.EnvironmentPermission



I have a little program that I wrote in vb.net v2 to process some stuff when
a user logs into the domain.

I have created a manifest for the project so that it would work for XP and
Vista and used mt.exe as a post build process to embed that into my .exe file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="asInvoker">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>
</assembly>

I also ran:
caspol -pp off -machine -addgroup All_Code -url
file://<ourdomainname>/SYSVOL/* FullTrust -name LoginStuff -description
"Login Programs"


When I try to run the app from the network I get this error:
************** Exception Text **************
System.Security.SecurityException: Request for the permission of type
'System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Environment.get_UserDomainName()
at login.frmLogin.frmLogin_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.EnvironmentPermission
The Zone of the assembly that failed was:
Intranet

I even tried going into IE and setting the local Intranet zone to contain
file://<ourdomainname>/SYSVOL/*

I'm missing something but I'm not getting what I'm missing. Anyone got an
idea for me?



.



Relevant Pages

  • RE: System.Security.Permissions.EnvironmentPermission
    ... CASPOL on a Vista 32-Bit machine did work. ... IntPtr wparam, IntPtr lparam) ... I even tried going into IE and setting the local Intranet zone to contain ... I'm missing something but I'm not getting what I'm missing. ...
    (microsoft.public.vstudio.general)
  • Tooltip bug in new .NET Servicepack
    ... Is there any explanations to this behavior ?? ... at System.Windows.Forms.ToolTip.HandleCreated(Object sender, EventArgs ... IntPtr wparam, IntPtr lparam) ... We use this command: ...
    (microsoft.public.dotnet.framework)
  • Conversion problems going to vs2008
    ... at OrderManager.frmGrid_orders.cmdselect_Click(Object sender, EventArgs e) ... at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ...
    (microsoft.public.vstudio.general)
  • RE: Value of 0 is not valid for SelectedIndex
    ... Stack Trace: ... at SpeedConnect.FormOptimizer.FormOptimizer_VisibleChanged(Object sender, EventArgs e) ... at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Troubles deploying my application
    ... private void txtPNameLast_Validated(object sender, EventArgs e) ... at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ...
    (microsoft.public.dotnet.general)

Loading