Brandon blogs, just for you.

Code Access Security Policy (CASPOL.exe) GUI Utility

with 18 comments

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

About these ads

Written by Brandon

January 23, 2010 at 2:22 pm

Posted in Uncategorized

18 Responses

Subscribe to comments with RSS.

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

    Turker Tunali

    February 10, 2010 at 3:04 am

  2. hello friend!
    you have done a wonderful job
    thank you


    February 18, 2010 at 3:49 am

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

    rennie Lative

    February 25, 2010 at 9:05 am

  4. hi there!

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



    April 26, 2010 at 4:31 pm

  5. 10x TNX !!!


    July 26, 2010 at 7:35 am

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


    Lynn Huff

    August 13, 2010 at 10:37 am

  7. thanks alot man.. life saver…

    jerome nicholas

    September 20, 2010 at 3:36 pm

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


    October 22, 2010 at 5:37 am

    • @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. :)


      October 22, 2010 at 6:47 am

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


    November 2, 2010 at 4:22 am

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


    April 19, 2011 at 9:14 am

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


    September 18, 2011 at 1:41 pm

    • Comments like that make code worth writing! :) Thanks Dan.


      September 18, 2011 at 9:18 pm

  12. Thank you!


    August 27, 2012 at 3:04 pm

  13. Thank you, Brandon. Regards from Spain.

    Ivan Ferrer

    October 18, 2012 at 7:48 pm

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

    Ralph Dell

    September 16, 2013 at 4:02 pm

  15. GR888888


    December 24, 2013 at 4:00 am

  16. […] So after a lot of trial and error with different command lines I found a great tool called “Code Access Security Policy (CASPOL) command Generator” from […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: