none
caspol.exe and vista RRS feed

  • Question

  •  

    I have a windowsform application written in vb.net that is often run from a network share. I have a workstation installer setup.exe that runs a vbscript with the line below to allow the application to run across the network. This works fine on XP machines. On vista it will run but it I am still getting a security error when launching the application. As far as I can tell, it is the same error that I get on an XP machine before running the caspol line. Is there a different syntax on Vista? Or some other reason that this works on XP and not Vista?

     

    Code Snippet

     shell.Run(strDotnetfolder & "caspol.exe -q -m -ag 1.2 -url " & strDirectory & "* FullTrust",0,true)

     

     

    Friday, May 9, 2008 2:31 AM

Answers

  • My understanding is that there are versions of code access security for each version of the .net framework and then also for each bit version(x86, x64).

    This means that if your code is compiled to take advantage of x64 you need to set the code access security using the caspol in the Framework64 directory.

    For the 2.0 framework on my computer the two caspol versions are found in...
    x32 version - C:\Windows\Microsoft.NET\Framework\v2.0.50727
    x64 version - C:\Windows\Microsoft.NET\Framework64\v2.0.50727

    Try using caspol in your x64 directory to set your trust levels.
    Tuesday, June 17, 2008 3:54 PM

All replies

  • If you look at the exception it should tell you what zone your program is being run from, and this might be different than the one you're adding security rights to, ie. the "1.2" zone here, which I assume is still corresponding to "Intranet" on your XP. It might be you need to change to 1.3, Internet-zone for your app on vista.

    We've seen similar issues here so we have a small program that tries to do something it isn't allowed to and reports out the caspol command you need to execute to get it working (minus the path, apparently that is off limits as well).
    Friday, May 9, 2008 10:23 AM
  • Fantastic. Thank you. Could you possibly share that little program? That would be a tremendous help to me to understand how caspol works.

     

    Friday, May 9, 2008 1:17 PM
  • Here's the error I am getting. I don't see where it is telling me the zone.

     

    The Following Error Occurred: 5 Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.  Current Context: Sub Mainmscorlib   will now attempt to shutdown gracefully.

     

    Friday, May 9, 2008 4:43 PM
  • I tried running the command again using 1.3. The command works and I now have permission for the machine to the directory in both intranet and inernet zones, but when I run the application I get the same error. This is vista x64. Would that be a different issue?

    Monday, May 12, 2008 5:46 PM
  • Still unresolved. Has anyone accomplished running caspol on vista x64?

     

    Wednesday, May 14, 2008 1:45 PM
  • My understanding is that there are versions of code access security for each version of the .net framework and then also for each bit version(x86, x64).

    This means that if your code is compiled to take advantage of x64 you need to set the code access security using the caspol in the Framework64 directory.

    For the 2.0 framework on my computer the two caspol versions are found in...
    x32 version - C:\Windows\Microsoft.NET\Framework\v2.0.50727
    x64 version - C:\Windows\Microsoft.NET\Framework64\v2.0.50727

    Try using caspol in your x64 directory to set your trust levels.
    Tuesday, June 17, 2008 3:54 PM