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:

image

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#).

21 thoughts on “Code Access Security Policy (CASPOL.exe) GUI Utility

  1. 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!!

    THANK YOU! THANK YOU!

    Reply
  2. 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.

    Reply
    1. 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. :)

      Reply
  3. 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.

    Reply
  4. 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.

    Reply
  5. Pingback:

  6. Pingback:

  7. 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.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>