Code Access Security Policy (CASPOL.exe) GUI Utility

I find it extraordinarily difficult (okay… inconvenient?) to make Code Access Security Policy changes in the .NET Framework. After .NET 2.0, outside of the SDK, the graphical tools for doing this were no longer installed on most client PC’s. Usually, when I have to break out caspol.exe, it’s possibly because:

  1. I downloaded a third party DLL from a web site, and it’s not trusted, with no unblock option, and Visual Studio is complaining about it when I’m actually trying to get some real work done
  2. I want to run some .NET apps off a network share, and the machine I’m using doesn’t have .NET 3.5 SP1.

… and it’s used so infrequently that I have to look up all the command line options and re-learn the thing every time, not to mention when I finally get the command right, I’m not in Elevated Privileges mode (Vista / Win 7).

So, for those like me, who like GUIs, and just want to get an assembly or folder trusted and move on with life, I present to you – a GUI CASPOL command generator:


This supports a subset of the available CASPOL commands:

  • Single file / assembly
  • Folder path / network share
  • Different scopes (Machine / User / Enterprise)
  • Trust Level (FullTrust by default)
  • Code Groups
  • Run CASPOL command in Elevated mode

For the small executable - Download It Here (9K)

… or, here’s the source project (VS2008 / C#).

  • Great utility. Even if user doesn't have administrative rights, log in/password screen shows up. It has many parameters and also shows generated "caspol.exe" parameters.


    hello friend!
    you have done a wonderful job
    thank you

  • Thank you so much. U must be an angel straight from God.

  • hi there!

    it's an incredible tool it has helped me a lot!


  • mario

    10x TNX !!!

  • Lynn Huff

    Why couldn't the jack wagons at MS have just provided this tool? Some of us need things like this on RARE ocassions. And because its RARE, we can't be expected to remember all of the commands. We shouldn't have to wade through pages of switch descriptions to figure out how to execute one line of code!!


  • jerome nicholas

    thanks alot man.. life saver...

  • CheesyPeteza

    When browsing for a folder I only had the option to look under My Computer, not My Network Places. I need to select a full UNC path to a network share so this is a problem.

    I could copy and paste it manually, but then why use this tool? The idea for me anyway is to take out the human error from manually putting together the command.

    • Brandon

      @CheesyPeteza, if you can already copy and paste it manually and would save you more time than using the tool, then by all means, do what's best for you. However, if you want to customize it to fit your particular need, the source code is posted at the bottom of the post. 🙂

  • CheesyPeteza

    No problem I will alter it, I just thought you might want to change it for others.

    I'll be mainly giving this to others to use and I don't like to say, here use this, oh btw you can't ... so you have to ...

    I prefer, here use this.

  • Ioana

    This is not working for .net Framework 4.0. Any idea why?

  • dan

    Thank you SO MUCH. You just saved me some time. Time that I can enjoy, rather than time figuring out how to properly use caspol.exe. Microsoft should provide a GUI just like this. Instant Karma coming your way.

    • Brandon

      Comments like that make code worth writing! 🙂 Thanks Dan.

  • Thank you!

  • Thank you, Brandon. Regards from Spain.

  • Ralph Dell

    Thank you for providing the tool.Way to many hours spent try to wrestling with microsoft.
    R. Dell

  • Prakash


  • Pingback: ()

  • Pingback: ()

  • John Riggle

    Dude, you saved my ass. I found there is an interesting problem with setting .net security using caspol on Server 2008, and 2012. The settings i was using on desktops, didn't work on the servers. Your gui, gave me a different way to do it, but it worked.

    • Brandon

      Thanks for this!! Love seeing problems solved!